override_this_wccs

The WooCommerce Checkout Manager override this wccs function.

Description

override_this_wccs(); 

Usage

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

Defined (1)

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

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