billing_override_this_wccs

The WooCommerce Checkout Manager billing override this wccs function.

Description

billing_override_this_wccs(); 

Usage

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

Defined (1)

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

/includes/templates/functions/billing_functions.php  
  1. function billing_override_this_wccs() { 
  2. global $woocommerce; 
  3. $options = get_option( 'wccs_settings3' ); 
  4. if ( count( $options['billing_buttons'] ) > 0 ) { 
  5. $i = 0; 
  6.  
  7. // css sub-parent hide 
  8. foreach( $options['billing_buttons'] as $btn ) { 
  9. if ( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {  
  10. echo '<style type="text/css">#billing_'.$btn['cow'].'_applynow { 
  11. background: -webkit-gradient(linear, left top, left bottom, from(#ad74a2), to(#96588a)); 
  12. background: -webkit-linear-gradient(#ad74a2, #96588a); 
  13. background: -moz-linear-gradient(center top, #ad74a2 0, #96588a 100%); 
  14. background: -moz-gradient(center top, #ad74a2 0, #96588a 100%); 
  15. border-color: #76456c; 
  16. color: #fff; 
  17. text-shadow: 0 -1px 0 rgba(0, 0, 0, .6); 
  18. width: 100%; 
  19. text-align: center; 
  20. float: right; 
  21. cursor: pointer; 
  22. position: relative; 
  23. #billing_'.$btn['cow'].'_applynow:active { 
  24. top: 1px; 
  25. </style>'; 
  26.  
  27. if ( !empty($btn['conditional_tie']) && empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use'])) { 
  28. echo '<style type="text/css"> 
  29. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',  
  30. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',  
  31. .woocommerce form.checkout #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {  
  32. display: none;  
  33. </style>'; 
  34.  
  35.  
  36.  
  37.  
  38. // ====================== CHECKBOX ============================= 
  39. // script when clicked show 
  40. // ============================================================= 
  41. ?> 
  42. <script type="text/javascript"> 
  43. jQuery(document).ready(function($) { 
  44.  
  45. <?php 
  46. foreach( $options['billing_buttons'] as $btn ) { 
  47. if ( $btn['type'] == 'checkbox_wccm' ) { 
  48.  
  49. if ( !empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) { ?> 
  50.  
  51. jQuery("#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]").click(function() { 
  52.  
  53. <?php foreach( $options['billing_buttons'] as $btn3 ) { 
  54. if ( empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) { ?> 
  55.  
  56. if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) { 
  57. jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" ); 
  58.  
  59. if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) { 
  60. jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" ); 
  61.  
  62.  
  63. <?php if ( !empty($btn2['fee_name']) && !empty($btn2['add_amount']) ) { ?> 
  64.  
  65. $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } }); 
  66.  
  67.  
  68. var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>'; 
  69. data = { 
  70. action: 'remove_tax_wccm',  
  71. empty_check_add: 'none' 
  72. }; 
  73.  
  74. jQuery.post(ajaxurl, data, function(response) { 
  75. $( 'body' ).trigger( 'update_checkout' ); 
  76. jQuery('form.checkout').unblock();  
  77. }); 
  78.  
  79. <?php } ?>  
  80.  
  81.  
  82. <?php }} ?> 
  83.  
  84. }); 
  85. <?php }}} ?> 
  86. }); 
  87. </script> 
  88.  
  89. <?php 
  90. // ================================ END!!! ===================================== 
  91. // ============================================================================= 
  92.  
  93.  
  94.  
  95. // ====================== SELECT OPTIONS ============================= 
  96. // script when clicked show 
  97. // ============================================================= 
  98. ?> 
  99. <script type="text/javascript"> 
  100. jQuery(document).ready(function($) { 
  101.  
  102. <?php 
  103. foreach( $options['billing_buttons'] as $btn ) { 
  104. if ( ($btn['type'] == 'wooccmselect') ) { 
  105.  
  106. if ( !empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) { ?> 
  107.  
  108. jQuery("#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> select").change(function() { 
  109.  
  110. <?php foreach( $options['billing_buttons'] as $btn3 ) { 
  111. if ( empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) { ?> 
  112.  
  113. if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie'].' #billing_'.$btn['cow'].''; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>' ) { 
  114. jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" ); 
  115.  
  116. if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie'].' #billing_'.$btn['cow'].''; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) { 
  117. jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" ); 
  118.  
  119. <?php if ( !empty($btn2['fee_name']) && !empty($btn2['add_amount']) ) { ?> 
  120.  
  121. $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } }); 
  122.  
  123.  
  124. var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>'; 
  125. data = { 
  126. action: 'remove_tax_wccm',  
  127. empty_check_add: 'none' 
  128. }; 
  129.  
  130. jQuery.post(ajaxurl, data, function(response) { 
  131. $( 'body' ).trigger( 'update_checkout' ); 
  132. jQuery('form.checkout').unblock();  
  133. }); 
  134.  
  135. <?php } ?>  
  136. <?php }} ?> 
  137. }); 
  138. <?php }}} ?> 
  139. }); 
  140. </script> 
  141.  
  142.  
  143. <?php 
  144. // ================================ END!!! ===================================== 
  145. // ============================================================================= 
  146.  
  147.  
  148.  
  149. // ====================== RADIO BUTTON ============================= 
  150. // script when clicked show 
  151. // ============================================================= 
  152. ?> 
  153. <script type="text/javascript"> 
  154. jQuery(document).ready(function($) { 
  155.  
  156. <?php 
  157. foreach( $options['billing_buttons'] as $btn ) { 
  158. if ( $btn['type'] == 'wooccmradio' ) { 
  159.  
  160. if ( !empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) { ?> 
  161.  
  162. jQuery("#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input").click(function() { 
  163.  
  164. <?php foreach( $options['billing_buttons'] as $btn3 ) { 
  165. if ( empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) { ?> 
  166.  
  167. if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) { 
  168. jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" ); 
  169.  
  170. if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) { 
  171. jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" ); 
  172.  
  173. <?php 
  174. if ( !empty($btn2['fee_name']) && !empty($btn2['add_amount']) ) { 
  175. ?> 
  176. $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } }); 
  177.  
  178. var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>'; 
  179. data = { 
  180. action: 'remove_tax_wccm',  
  181. empty_check_add: 'none' 
  182. }; 
  183.  
  184. jQuery.post(ajaxurl, data, function(response) { 
  185. $( 'body' ).trigger( 'update_checkout' ); 
  186. jQuery('form.checkout').unblock();  
  187. }); 
  188.  
  189. <?php } ?>  
  190.  
  191.  
  192. <?php }} ?> 
  193.  
  194. }); 
  195. <?php }}} ?> 
  196. }); 
  197. </script> 
  198.  
  199.  
  200.  
  201. <?php 
  202. // ================================ END!!! ===================================== 
  203. // ============================================================================= 
  204.  
  205.  
  206.  
  207. // ----------------------------- CLEAR --------------------------------- 
  208. // --------------------------------------------------------------------- 
  209. // --------------------------------------------------------------------- 
  210. foreach( $options['billing_buttons'] as $btn ) { 
  211. foreach ($woocommerce->cart->cart_contents as $key => $values ) { 
  212.  
  213. $multiproductsx = $btn['single_p']; 
  214. $show_field_single = $btn['single_px']; 
  215. $multiproductsx_cat = $btn['single_p_cat']; 
  216. $show_field_single_cat = $btn['single_px_cat']; 
  217.  
  218.  
  219. $productsarraycm[] = $values['product_id']; 
  220.  
  221. // Products 
  222. // hide field 
  223.  
  224. // without more 
  225. if ( !empty($btn['single_p']) && empty($btn['more_content']) ) { 
  226. $multiarrayproductsx = explode(', ', $multiproductsx); 
  227.  
  228. if(in_array($values['product_id'], $multiarrayproductsx) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  229. echo '<style type="text/css"> 
  230. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  231. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  232. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  233. display: none;  
  234. </style>'; 
  235. }} 
  236.  
  237.  
  238. // show field without more 
  239. if ( !empty($btn['single_px']) && empty($btn['more_content']) ) { 
  240. $show_field_array = explode('||', $show_field_single); 
  241.  
  242. if(in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  243. echo '<style type="text/css"> 
  244. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  245. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  246. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  247. display: inline-block;  
  248. </style>'; 
  249.  
  250. if(!in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  251. echo '<style type="text/css"> 
  252. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  253. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  254. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  255. display: none;  
  256. </style>'; 
  257. }} 
  258.  
  259.  
  260. // Category 
  261. // hide field 
  262. $terms = get_the_terms( $values['product_id'], 'product_cat' ); 
  263. if ( !empty($terms) ) { 
  264. foreach ( $terms as $term ) { 
  265.  
  266. $categoryarraycm[] = $term->slug; 
  267.  
  268. // without more 
  269.  
  270. if ( !empty($btn['single_p_cat']) && empty($btn['more_content']) ) { 
  271. $multiarrayproductsx_cat = explode(', ', $multiproductsx_cat); 
  272. if(in_array($term->slug, $multiarrayproductsx_cat) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  273. echo '<style type="text/css"> 
  274. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  275. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  276. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  277. display: none;  
  278. </style>'; 
  279. }} 
  280.  
  281.  
  282. // show field without more 
  283. if ( !empty($btn['single_px_cat']) && empty($btn['more_content']) ) { 
  284. $show_field_array_cat = explode('||', $show_field_single_cat); 
  285.  
  286. if(in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  287. echo '<style type="text/css"> 
  288. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  289. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  290. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  291. display: inline-block;  
  292. </style>'; 
  293.  
  294. if( !in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2) ) { 
  295. echo '<style type="text/css"> 
  296. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  297. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  298. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  299. display: none;  
  300. </style>'; 
  301. }} 
  302.  
  303.  
  304.  
  305. }}  
  306. } // end cart 
  307.  
  308.  
  309.  
  310. // =========================================================================================== 
  311. // Products 
  312. // hide field 
  313.  
  314. // with more 
  315. if ( !empty($btn['single_p']) && !empty($btn['more_content']) ) { 
  316. $multiarrayproductsx = explode(', ', $multiproductsx); 
  317.  
  318. if(array_intersect($productsarraycm, $multiarrayproductsx) ) { 
  319. echo '<style type="text/css"> 
  320. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  321. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  322. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  323. display: none;  
  324. </style>'; 
  325. }} 
  326.  
  327.  
  328. // show field with more 
  329. if ( !empty($btn['single_px']) && !empty($btn['more_content']) ) { 
  330. $show_field_array = explode('||', $show_field_single); 
  331.  
  332. if(array_intersect($productsarraycm, $show_field_array) ) { 
  333. echo '<style type="text/css"> 
  334. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  335. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  336. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  337. display: inline-block;  
  338. </style>'; 
  339.  
  340. if(!array_intersect($productsarraycm, $show_field_array) ) { 
  341. echo '<style type="text/css"> 
  342. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  343. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  344. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  345. display: none;  
  346. </style>'; 
  347. }} 
  348.  
  349.  
  350.  
  351.  
  352. // Category 
  353. // hide field 
  354.  
  355. // with more 
  356. if ( !empty($btn['single_p_cat']) && !empty($btn['more_content']) ) { 
  357. $multiarrayproductsx_cat = explode(', ', $multiproductsx_cat); 
  358.  
  359. if(array_intersect($categoryarraycm, $multiarrayproductsx_cat) ) { 
  360. echo '<style type="text/css"> 
  361. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  362. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  363. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  364. display: none;  
  365. </style>'; 
  366. }} 
  367.  
  368.  
  369. // show field with more 
  370. if ( !empty($btn['single_px_cat']) && !empty($btn['more_content']) ) { 
  371. $show_field_array_cat = explode('||', $show_field_single_cat); 
  372.  
  373. if(array_intersect($categoryarraycm, $show_field_array_cat) ) { 
  374. echo '<style type="text/css"> 
  375. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  376. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  377. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  378. display: inline-block;  
  379. </style>'; 
  380.  
  381. if( !array_intersect($categoryarraycm, $show_field_array_cat) ) { 
  382. echo '<style type="text/css"> 
  383. .woocommerce form #customer_details #billing_'.$btn['cow'].'_field,  
  384. .woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,  
  385. .woocommerce form.checkout #billing_'.$btn['cow'].'_field {  
  386. display: none;  
  387. </style>'; 
  388. }} 
  389.  
  390.  
  391. $categoryarraycm = ''; 
  392. $productsarraycm = ''; 
  393.  
  394. } // btn cut 
  395.  
  396.  
  397. }}