shipping_wccm_ccfcustomcheckoutprocessnow

The WooCommerce Checkout Manager shipping wccm ccfcustomcheckoutprocessnow function.

Description

shipping_wccm_ccfcustomcheckoutprocessnow(); 

Usage

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

Defined (1)

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

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