wccm_ccfcustomcheckoutprocessnow

The WooCommerce Checkout Manager wccm ccfcustomcheckoutprocessnow function.

Description

wccm_ccfcustomcheckoutprocessnow(); 

Usage

  1. if ( !function_exists( 'wccm_ccfcustomcheckoutprocessnow' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/templates/functions/required/add_required.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wccm_ccfcustomcheckoutprocessnow(); 
  7.  

Defined (1)

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

/includes/templates/functions/required/add_required.php  
  1. function wccm_ccfcustomcheckoutprocessnow() { 
  2. global $woocommerce; 
  3. $options = get_option( 'wccs_settings' ); 
  4.  
  5.  
  6. if ( count( $options['buttons'] ) > 0 ) { 
  7.  
  8. foreach( $options['buttons'] as $btn ) { 
  9. foreach ($woocommerce->cart->cart_contents as $key => $values ) { 
  10.  
  11. $multiproductsx = $btn['single_p']; 
  12. $show_field_single = $btn['single_px']; 
  13. $multiproductsx_cat = $btn['single_p_cat']; 
  14. $show_field_single_cat = $btn['single_px_cat']; 
  15.  
  16.  
  17. $productsarraycm[] = $values['product_id']; 
  18.  
  19. // Products  
  20. // hide field 
  21.  
  22.  
  23. // show field without more 
  24. if ( !empty($btn['single_px']) && empty($btn['more_content']) ) { 
  25. $show_field_array = explode('||', $show_field_single); 
  26.  
  27. if(in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  28. if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) { 
  29. if (!$_POST[''.$btn['cow'].''] ) { 
  30. wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), error ); 
  31.  
  32.  
  33.  
  34. // Category 
  35. // hide field 
  36. $terms = get_the_terms( $values['product_id'], 'product_cat' ); 
  37. if ( !empty($terms) ) { 
  38. foreach ( $terms as $term ) { 
  39.  
  40. $categoryarraycm[] = $term->slug; 
  41.  
  42. // without more 
  43.  
  44. // show field without more 
  45. if ( !empty($btn['single_px_cat']) && empty($btn['more_content']) ) { 
  46. $show_field_array_cat = explode('||', $show_field_single_cat); 
  47.  
  48. if(in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  49. if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) { 
  50. if (!$_POST[''.$btn['cow'].''] ) { 
  51. wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), error ); 
  52.  
  53. }}  
  54. } // end cart 
  55.  
  56.  
  57.  
  58. // =========================================================================================== 
  59. // Products 
  60. // hide field 
  61.  
  62.  
  63. // show field with more 
  64. if ( !empty($btn['single_px']) && !empty($btn['more_content']) ) { 
  65. $show_field_array = explode('||', $show_field_single); 
  66.  
  67. if(array_intersect($productsarraycm, $show_field_array) ) { 
  68. if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) { 
  69. if (!$_POST[''.$btn['cow'].''] ) { 
  70. wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), error ); 
  71.  
  72.  
  73.  
  74.  
  75.  
  76. // Category 
  77. // hide field 
  78.  
  79. // with more 
  80.  
  81.  
  82. // show field with more 
  83. if ( !empty($btn['single_px_cat']) && !empty($btn['more_content']) ) { 
  84. $show_field_array_cat = explode('||', $show_field_single_cat); 
  85.  
  86. if(array_intersect($categoryarraycm, $show_field_array_cat) ) { 
  87. if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) { 
  88. if (!$_POST[''.$btn['cow'].''] ) { 
  89. wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), error ); 
  90.  
  91.  
  92. $categoryarraycm = ''; 
  93. $productsarraycm = ''; 
  94.  
  95. }}}