wpp_payments_form

The Woocommerce Product Payments wpp payments form function.

Description

wpp_payments_form(); 

Usage

  1. if ( !function_exists( 'wpp_payments_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-product-payments/index.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpp_payments_form(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/index.php  
  1. function wpp_payments_form() { 
  2. global $post, $woo; 
  3.  
  4. $productIds = get_option('woocommerce_product_apply'); 
  5. if (is_array($productIds)) { 
  6. foreach ($productIds as $key => $product) { 
  7. if (!get_post($product) || !count(get_post_meta($product, 'payments', true))) { 
  8. unset($productIds[$key]); 
  9. update_option('woocommerce_product_apply', $productIds); 
  10.  
  11. $postPayments = count(get_post_meta($post->ID, 'payments', true)) ? get_post_meta($post->ID, 'payments', true) : array(); 
  12. if (count($productIds) >= 10 && !count($postPayments)) { 
  13. echo 'Limit reached Please download full version package at www.dreamfoxmedia.nl!'; 
  14. return; 
  15.  
  16. $woo = new WC_Payment_Gateways(); 
  17. $payments = $woo->payment_gateways; 
  18. foreach ($payments as $pay) { 
  19. /** 
  20. * skip if payment in disbled from admin 
  21. */ 
  22. if ($pay->enabled == 'no') { 
  23. continue; 
  24. $checked = ''; 
  25. if (is_array($postPayments) && in_array($pay->id, $postPayments)) { 
  26. $checked = ' checked="yes" '; 
  27. ?>  
  28. <input type="checkbox" <?php echo $checked; ?> value="<?php echo $pay->id; ?>" name="pays[]" id="payment_<?php echo $pay->id; ?>" /> 
  29. <label for="payment_<?php echo $pay->id; ?>"><?php echo $pay->title; ?></label>  
  30. <br />  
  31. <?php