WooCommerce Checkout Manager - Version 4.4.5

Version Description

  • Improvement: woocommerce checkout conditional fields rebuilt
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 4.4.5
Comparing to
See all releases

Code changes from version 4.4.4 to 4.4.5

assets/css/wooccm.css.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../less/wooccm.less"],"names":[],"mappings":"AAAA;EACE,WAAA;;AACA,gBAAC;AACC,gBAAC;EACD,SAAQ,EAAR;EACA,cAAA;;AAEF,gBAAC;EACC,WAAA;;AAMF,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAMN;EACE,cAAA;EACA,UAAA;EACA,aAAA;EACA,eAAA;EACA,mBAAA;EACA,sBAAA;;AANF,kBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EACA,gBAAA;EACA,kBAAA;;AAhBJ,kBAQE,mBAWE;EACE,kBAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;EACA,eAAA;;AAjCN,kBAQE,mBA6BE;EACE,WAAA;EACA,gBAAA","file":"wooccm.css"}
 
includes/classes/field_filters.php CHANGED
@@ -411,7 +411,7 @@ function wooccm_checkout_field_state_handler( $field = '', $key, $args, $value )
411
  else
412
  $after = '';
413
 
414
- $args['class'][] = 'address-field';
415
 
416
  $country_key = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
417
  $current_cc = WC()->checkout->get_value( $country_key );
@@ -536,7 +536,7 @@ function wooccm_checkout_field_country_handler( $field = '', $key, $args, $value
536
  else
537
  $after = '';
538
 
539
- $args['class'][] = 'address-field';
540
 
541
  if( $args['wooccm_required'] ) {
542
  $args['class'][] = 'validate-required';
411
  else
412
  $after = '';
413
 
414
+ //$args['class'][] = 'address-field';
415
 
416
  $country_key = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
417
  $current_cc = WC()->checkout->get_value( $country_key );
536
  else
537
  $after = '';
538
 
539
+ //$args['class'][] = 'address-field';
540
 
541
  if( $args['wooccm_required'] ) {
542
  $args['class'][] = 'validate-required';
includes/templates/functions/add_functions.php CHANGED
@@ -2,584 +2,336 @@
2
  /**
3
  * WooCommerce Checkout Manager
4
  */
5
-
6
  // Exit if accessed directly
7
- if ( !defined( 'ABSPATH' ) ) exit;
8
-
9
 
10
  function wooccm_scripts() {
11
 
12
- global $woocommerce;
13
 
14
- $options = get_option( 'wccs_settings' );
15
 
16
- $saved = WC()->session->get( 'wooccm_retain', array() );
17
 
18
- // Check if we have any buttons
19
- if( empty( $options['buttons'] ) )
20
- return;
21
 
22
- foreach( $options['buttons'] as $btn ) {
23
 
24
- if( $btn['type'] == 'datepicker' ) {
25
- echo '
26
  <script type="text/javascript">
27
  jQuery(document).ready(function() {
28
  var today = new Date();
29
  if( jQuery.isFunction(jQuery.fn.datepicker) ) {
30
- jQuery("input#'.$btn['cow'].'").datepicker({
31
  ';
32
- // Default date format
33
- if( empty($btn['format_date']) )
34
- $btn['format_date'] = apply_filters( 'wooccm_datepicker_default_date_format', 'dd-mm-yy' );
35
- if( !empty($btn['format_date']) ) {
36
- echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
37
- }
38
- if( !empty($btn['single_yy']) ) {
39
- echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
40
- }
41
- if( !empty($btn['min_before']) ) {
42
- echo 'minDate: '.$btn['min_before'].',';
43
- }
44
- if( !empty($btn['single_max_yy']) ) {
45
- echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
46
- }
47
- if( !empty($btn['max_after']) ) {
48
- echo 'maxDate: '.$btn['max_after'].',';
49
- }
50
- if( !empty($btn['days_disabler']) ) {
51
- echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
52
- if( !empty($btn['days_disabler0']) ) {
53
- echo 'day == 0';
54
- } else { echo 'day == "x"'; }
55
- if( !empty($btn['days_disabler1']) ) {
56
- echo ' || day == 1';
57
- }
58
- if( !empty($btn['days_disabler2']) ) {
59
- echo ' || day == 2';
60
- }
61
- if( !empty($btn['days_disabler3']) ) {
62
- echo ' || day == 3';
63
- }
64
- if( !empty($btn['days_disabler4']) ) {
65
- echo ' || day == 4';
66
- }
67
- if( !empty($btn['days_disabler5']) ) {
68
- echo ' || day == 5';
69
- }
70
- if( !empty($btn['days_disabler6']) ) {
71
- echo '|| day == 6';
72
- }
73
- echo ')]; }';
74
- }
75
- do_action( 'wooccm_js_datepicker_additional_args', $btn );
76
- echo '
 
 
77
  });
78
  }
79
  });
80
  </script>
81
  ';
82
- }
83
 
84
- if( $btn['type'] == 'time' ) {
85
- $args = '
86
  showPeriod: true,';
87
- if( !empty($btn['start_hour']) ) {
88
- $args .= '
89
- hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
90
- }
91
- if( !empty($btn['interval_min']) ) {
92
- $args .= '
93
- minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
94
- }
95
- $args .= '
96
  showLeadingZero: true';
97
- $args = apply_filters( 'wooccm_timepicker_jquery_args', $args, $btn );
98
- echo '
99
  <!-- Additional section: TimePicker -->
100
  <script type="text/javascript">
101
  jQuery(document).ready(function() {
102
  if( jQuery.isFunction(jQuery.fn.timepicker) ) {
103
- jQuery("#'.$btn['cow'].'_field input#'.$btn['cow'].'").timepicker({'
104
- ;
105
- echo $args;
106
- echo '
107
  });
108
  }
109
  });
110
  </script>
111
  ';
112
- }
113
 
114
- if ( $btn['type'] == 'password' ) {
115
- echo '
116
  <script type="text/javascript">
117
  jQuery(document).ready(function() {
118
- jQuery("p#'.$btn['cow'].'_field").css("display");
119
  });
120
  </script>
121
  ';
122
- }
123
-
124
- if( $btn['type'] == 'colorpicker' ) {
125
- switch( $btn['colorpickertype'] ) {
126
-
127
- case 'farbtastic':
128
- ?>
129
- <script type="text/javascript">
130
- jQuery(document).ready(function($) {
131
- jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
132
- if( jQuery.isFunction(jQuery.fn.farbtastic) ) {
133
- jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#<?php echo $btn['cow']; ?>_colorpicker");
134
- jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
135
- }
136
- });
137
- </script>
138
- <?php
139
- break;
140
-
141
- case 'iris':
142
- ?>
143
- <script type="text/javascript">
144
- jQuery(document).ready(function($) {
145
-
146
- $( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
147
- $( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
148
-
149
- var options = {
150
- wccmclass: "<?php echo $btn['cow']; ?>_colorpickerdiv",
151
- palettes: true,
152
- color: "",
153
- hide: false,
154
- change: function(event,ui){
155
- $( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
156
- $( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
157
- }
158
- };
159
-
160
- jQuery('#<?php echo $btn['cow']; ?>_colorpicker').iris( options );
161
- jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
162
- jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
163
-
164
- });
165
- </script>
166
- <?php
167
- break;
168
-
169
- }
170
- }
 
 
 
171
 
172
  // ============================== radio button & checkbox ===========================================
173
 
174
- if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['tax_remove'] ) ) {
175
- ?>
176
- <script type="text/javascript">
177
- jQuery(document).ready(function($) {
178
-
179
- <?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
180
- jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
181
- <?php } ?>
182
-
183
- jQuery('#<?php echo $btn['cow']; ?>_field input').click(function() {
184
-
185
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
186
-
187
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
188
- data = {
189
- action: 'remove_tax_wccm',
190
- tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
191
- };
192
-
193
- jQuery.post(ajaxurl, data, function(response) {
194
- $( 'body' ).trigger( 'update_checkout' );
195
- jQuery('form.checkout').unblock();
196
- });
197
-
198
- });
199
- });
200
- </script>
201
- <?php
202
- }
203
-
204
- if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
205
- ?>
206
- <script type="text/javascript">
207
- jQuery(document).ready(function($) {
208
-
209
- <?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
210
- jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
211
- <?php } ?>
212
- jQuery('#<?php echo $btn['cow']; ?>_field input').click(function() {
213
-
214
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
215
-
216
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
217
- data = {
218
- action: 'remove_tax_wccm',
219
- add_amount_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
220
- };
221
-
222
- jQuery.post(ajaxurl, data, function(response) {
223
- $( 'body' ).trigger( 'update_checkout' );
224
- jQuery('form.checkout').unblock();
225
- });
226
-
227
- });
228
- });
229
- </script>
230
- <?php
231
- }
232
 
233
  // =========================================== select options =========================================
234
 
235
- if ( ($btn['type'] == 'wooccmselect') && !empty( $btn['tax_remove'] ) ) {
236
- ?>
237
- <script type="text/javascript">
238
- jQuery(document).ready(function($) {
239
-
240
- <?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
241
- jQuery('#<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
242
- <?php } ?>
243
- jQuery('#<?php echo $btn['cow']; ?>_field select').change(function() {
244
-
245
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
246
-
247
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
248
- data = {
249
- action: 'remove_tax_wccm',
250
- tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
251
- };
252
-
253
- jQuery.post(ajaxurl, data, function(response) {
254
- $( 'body' ).trigger( 'update_checkout' );
255
- jQuery('form.checkout').unblock();
256
- });
257
-
258
- });
259
- });
260
- </script>
261
- <?php
262
- }
263
-
264
- if ( ($btn['type'] == 'wooccmselect') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
265
- ?>
266
- <script type="text/javascript">
267
- jQuery(document).ready(function($) {
268
-
269
- <?php if( !empty( $saved['wooccm_addamount453user'] ) ) { ?>
270
- jQuery('#<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
271
- <?php } ?>
272
-
273
- jQuery('#<?php echo $btn['cow']; ?>_field select').change(function() {
274
-
275
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
276
-
277
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
278
- data = {
279
- action: 'remove_tax_wccm',
280
- add_amount_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
281
- };
282
-
283
- jQuery.post(ajaxurl, data, function(response) {
284
- $( 'body' ).trigger( 'update_checkout' );
285
- jQuery('form.checkout').unblock();
286
- });
287
-
288
- });
289
- });
290
- </script>
291
- <?php
292
- }
293
 
294
  // =========================================== add apply button ==========================================
295
 
296
- if ( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
297
- ?>
298
- <script type="text/javascript">
299
- jQuery(document).ready(function() {
300
- jQuery( "#<?php echo $btn['cow']; ?>_field" ).append( '<span id="<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply','woocommerce-checkout-manager'); ?></span>' );
301
- });
302
 
303
- jQuery(document).ready(function($) {
304
 
305
- <?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
306
- jQuery('input#<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
307
- <?php } ?>
308
 
309
- jQuery('#<?php echo $btn['cow']; ?>_field #<?php echo $btn['cow']; ?>_applynow').click(function() {
310
 
311
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
312
 
313
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
314
- data = {
315
- action: 'remove_tax_wccm',
316
- add_amount_faj: jQuery('input#<?php echo $btn['cow']; ?>').val()
317
- };
318
 
319
- jQuery.post(ajaxurl, data, function(response) {
320
- $( 'body' ).trigger( 'update_checkout' );
321
- jQuery('form.checkout').unblock();
322
- });
323
 
324
- });
325
 
326
- });
327
- </script>
328
- <?php
329
- }
330
 
331
  // =====================================================
332
-
333
- }
334
-
335
- }
336
-
337
- // --------------------------------------------------------
338
- // --------------------------------------------------------
339
- // --------------------------------------------------------
340
-
341
- function wooccm_override_this() {
342
-
343
- global $woocommerce;
344
-
345
- $options = get_option( 'wccs_settings' );
346
-
347
- $options['buttons'] = ( isset( $options['buttons'] ) ? $options['buttons'] : array() );
348
-
349
- // Check if there are any buttons
350
- if ( count( $options['buttons'] ) == 0 )
351
- return;
352
-
353
- $i = 0;
354
-
355
- // css sub-parent hide
356
- foreach( $options['buttons'] as $btn ) {
357
- if( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
358
- echo '
359
- <style type="text/css">
360
- #'.$btn['cow'].'_applynow {
361
- background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
362
- background: -webkit-linear-gradient(#ad74a2,#96588a);
363
- background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
364
- background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
365
- border-color: #76456c;
366
- color: #fff;
367
- text-shadow: 0 -1px 0 rgba(0,0,0,.6);
368
- width: 100%;
369
- text-align: center;
370
- float: right;
371
- cursor: pointer;
372
- position: relative;
373
- }
374
- #'.$btn['cow'].'_applynow:active {
375
- top: 1px;
376
- }
377
- </style>';
378
- }
379
- if( !empty( $btn['conditional_tie'] ) && empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) ) {
380
- echo '
381
- <style type="text/css">
382
- .woocommerce form #customer_details #'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
383
- .woocommerce-page form #customer_details #'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
384
- .woocommerce form.checkout #'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
385
- display: none;
386
- }
387
- </style>';
388
- }
389
- }
390
-
391
- // ====================== CHECKBOX =============================
392
- // script when clicked show
393
- // =============================================================
394
- ?>
395
- <!-- Additional section: Checkbox -->
396
- <script type="text/javascript">
397
- jQuery(document).ready(function($){
398
- <?php
399
- foreach( $options['buttons'] as $btn ) {
400
- if ( !empty( $btn['label'] ) && ($btn['type'] == 'checkbox_wccm') ) {
401
-
402
- if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
403
- ?>
404
-
405
- jQuery("#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]").click(function(){
406
-
407
- <?php
408
- foreach( $options['buttons'] as $btn3 ) {
409
- if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
410
- ?>
411
- if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
412
- jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
413
- }
414
- if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
415
- jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
416
-
417
- <?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
418
-
419
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
420
-
421
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
422
- data = {
423
- action: 'remove_tax_wccm',
424
- empty_check_add: 'none'
425
- };
426
-
427
- jQuery.post(ajaxurl, data, function(response) {
428
- $( 'body' ).trigger( 'update_checkout' );
429
- jQuery('form.checkout').unblock();
430
- });
431
-
432
- <?php } ?>
433
-
434
- }
435
-
436
- <?php
437
- }
438
- }
439
- ?>
440
-
441
- });
442
-
443
- <?php
444
- }
445
- }
446
- }
447
- ?>
448
- });
449
- </script>
450
- <?php
451
-
452
- // ================================ END!!! =====================================
453
- // =============================================================================
454
-
455
- // ====================== SELECT OPTIONS =============================
456
- // script when clicked show
457
- // =============================================================
458
- ?>
459
- <!-- Additional section: Select options -->
460
- <script type="text/javascript">
461
- jQuery(document).ready(function($){
462
-
463
- <?php
464
- foreach( $options['buttons'] as $btn ) {
465
- if( !empty( $btn['label'] ) && ($btn['type'] == 'wooccmselect') ) {
466
-
467
- if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
468
- ?>
469
-
470
- jQuery("#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function(){
471
-
472
- <?php
473
- foreach( $options['buttons'] as $btn3 ) {
474
- if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
475
- ?>
476
-
477
- if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
478
- jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
479
- }
480
-
481
- if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
482
- jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
483
-
484
- <?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
485
-
486
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
487
-
488
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
489
- data = {
490
- action: 'remove_tax_wccm',
491
- empty_check_add: 'none'
492
- };
493
-
494
- jQuery.post(ajaxurl, data, function(response) {
495
- $( 'body' ).trigger( 'update_checkout' );
496
- jQuery('form.checkout').unblock();
497
- });
498
-
499
- <?php } ?>
500
- }
501
- <?php
502
- }
503
- }
504
- ?>
505
- });
506
- <?php
507
- }
508
- }
509
- }
510
- ?>
511
- });
512
- </script>
513
-
514
- <?php
515
-
516
- // ================================ END!!! =====================================
517
- // =============================================================================
518
-
519
- // ====================== RADIO BUTTON =============================
520
- // script when clicked show
521
- // =============================================================
522
-
523
- ?>
524
- <!-- Additional section: Radio buttons -->
525
- <script type="text/javascript">
526
- jQuery(document).ready(function($){
527
-
528
- <?php
529
- foreach( $options['buttons'] as $btn ) {
530
- if ( !empty( $btn['label'] ) && ($btn['type'] == 'wooccmradio') ) {
531
-
532
- if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
533
- ?>
534
-
535
- jQuery("#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input").click(function(){
536
-
537
- <?php
538
- foreach( $options['buttons'] as $btn3 ) {
539
- if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
540
- ?>
541
-
542
- if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
543
- jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
544
- }
545
-
546
- if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
547
- jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
548
-
549
- <?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
550
-
551
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
552
-
553
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
554
- data = {
555
- action: 'remove_tax_wccm',
556
- empty_check_add: 'none'
557
- };
558
-
559
- jQuery.post(ajaxurl, data, function(response) {
560
- $( 'body' ).trigger( 'update_checkout' );
561
- jQuery('form.checkout').unblock();
562
- });
563
-
564
- <?php } ?>
565
-
566
- }
567
-
568
- <?php
569
- }
570
- }
571
- ?>
572
-
573
- });
574
- <?php
575
- }
576
- }
577
- }
578
- ?>
579
- });
580
- </script>
581
-
582
- <?php
583
-
584
  }
585
- ?>
2
  /**
3
  * WooCommerce Checkout Manager
4
  */
 
5
  // Exit if accessed directly
6
+ if (!defined('ABSPATH'))
7
+ exit;
8
 
9
  function wooccm_scripts() {
10
 
11
+ global $woocommerce;
12
 
13
+ $options = get_option('wccs_settings');
14
 
15
+ $saved = WC()->session->get('wooccm_retain', array());
16
 
17
+ // Check if we have any buttons
18
+ if (empty($options['buttons']))
19
+ return;
20
 
21
+ foreach ($options['buttons'] as $btn) {
22
 
23
+ if ($btn['type'] == 'datepicker') {
24
+ echo '
25
  <script type="text/javascript">
26
  jQuery(document).ready(function() {
27
  var today = new Date();
28
  if( jQuery.isFunction(jQuery.fn.datepicker) ) {
29
+ jQuery("input#' . $btn['cow'] . '").datepicker({
30
  ';
31
+ // Default date format
32
+ if (empty($btn['format_date']))
33
+ $btn['format_date'] = apply_filters('wooccm_datepicker_default_date_format', 'dd-mm-yy');
34
+ if (!empty($btn['format_date'])) {
35
+ echo 'dateFormat : "' . str_replace(' ', '', $btn['format_date']) . '",';
36
+ }
37
+ if (!empty($btn['single_yy'])) {
38
+ echo 'minDate: new Date( ' . $btn['single_yy'] . ', ' . $btn['single_mm'] . ' - 1, ' . $btn['single_dd'] . '),';
39
+ }
40
+ if (!empty($btn['min_before'])) {
41
+ echo 'minDate: ' . $btn['min_before'] . ',';
42
+ }
43
+ if (!empty($btn['single_max_yy'])) {
44
+ echo 'maxDate: new Date( ' . $btn['single_max_yy'] . ', ' . $btn['single_max_mm'] . ' - 1, ' . $btn['single_max_dd'] . '),';
45
+ }
46
+ if (!empty($btn['max_after'])) {
47
+ echo 'maxDate: ' . $btn['max_after'] . ',';
48
+ }
49
+ if (!empty($btn['days_disabler'])) {
50
+ echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
51
+ if (!empty($btn['days_disabler0'])) {
52
+ echo 'day == 0';
53
+ } else {
54
+ echo 'day == "x"';
55
+ }
56
+ if (!empty($btn['days_disabler1'])) {
57
+ echo ' || day == 1';
58
+ }
59
+ if (!empty($btn['days_disabler2'])) {
60
+ echo ' || day == 2';
61
+ }
62
+ if (!empty($btn['days_disabler3'])) {
63
+ echo ' || day == 3';
64
+ }
65
+ if (!empty($btn['days_disabler4'])) {
66
+ echo ' || day == 4';
67
+ }
68
+ if (!empty($btn['days_disabler5'])) {
69
+ echo ' || day == 5';
70
+ }
71
+ if (!empty($btn['days_disabler6'])) {
72
+ echo '|| day == 6';
73
+ }
74
+ echo ')]; }';
75
+ }
76
+ do_action('wooccm_js_datepicker_additional_args', $btn);
77
+ echo '
78
  });
79
  }
80
  });
81
  </script>
82
  ';
83
+ }
84
 
85
+ if ($btn['type'] == 'time') {
86
+ $args = '
87
  showPeriod: true,';
88
+ if (!empty($btn['start_hour'])) {
89
+ $args .= '
90
+ hours: { starts: ' . $btn['start_hour'] . ', ends: ' . $btn['end_hour'] . ' },';
91
+ }
92
+ if (!empty($btn['interval_min'])) {
93
+ $args .= '
94
+ minutes: {interval: ' . $btn['interval_min'] . ', manual: [' . $btn['manual_min'] . '] },';
95
+ }
96
+ $args .= '
97
  showLeadingZero: true';
98
+ $args = apply_filters('wooccm_timepicker_jquery_args', $args, $btn);
99
+ echo '
100
  <!-- Additional section: TimePicker -->
101
  <script type="text/javascript">
102
  jQuery(document).ready(function() {
103
  if( jQuery.isFunction(jQuery.fn.timepicker) ) {
104
+ jQuery("#' . $btn['cow'] . '_field input#' . $btn['cow'] . '").timepicker({'
105
+ ;
106
+ echo $args;
107
+ echo '
108
  });
109
  }
110
  });
111
  </script>
112
  ';
113
+ }
114
 
115
+ if ($btn['type'] == 'password') {
116
+ echo '
117
  <script type="text/javascript">
118
  jQuery(document).ready(function() {
119
+ jQuery("p#' . $btn['cow'] . '_field").css("display");
120
  });
121
  </script>
122
  ';
123
+ }
124
+
125
+ if ($btn['type'] == 'colorpicker') {
126
+ switch ($btn['colorpickertype']) {
127
+
128
+ case 'farbtastic':
129
+ ?>
130
+ <script type="text/javascript">
131
+ jQuery(document).ready(function ($) {
132
+ jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
133
+ if (jQuery.isFunction(jQuery.fn.farbtastic)) {
134
+ jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#<?php echo $btn['cow']; ?>_colorpicker");
135
+ jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function () {
136
+ jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
137
+ });
138
+ }
139
+ });
140
+ </script>
141
+ <?php
142
+ break;
143
+
144
+ case 'iris':
145
+ ?>
146
+ <script type="text/javascript">
147
+ jQuery(document).ready(function ($) {
148
+
149
+ $('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#fff');
150
+ $('#<?php echo $btn['cow']; ?>_colorpicker').css('background', '<?php echo $btn['colorpickerd']; ?>');
151
+
152
+ var options = {
153
+ wccmclass: "<?php echo $btn['cow']; ?>_colorpickerdiv",
154
+ palettes: true,
155
+ color: "",
156
+ hide: false,
157
+ change: function (event, ui) {
158
+ $('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#000');
159
+ $('#<?php echo $btn['cow']; ?>_colorpicker').css('background', ui.color.toString());
160
+ }
161
+ };
162
+
163
+ jQuery('#<?php echo $btn['cow']; ?>_colorpicker').iris(options);
164
+ jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
165
+ jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function () {
166
+ jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
167
+ });
168
+
169
+ });
170
+ </script>
171
+ <?php
172
+ break;
173
+ }
174
+ }
175
 
176
  // ============================== radio button & checkbox ===========================================
177
 
178
+ /*if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
179
+ ?>
180
+ <script type="text/javascript">
181
+ jQuery(document).ready(function ($) {
182
+
183
+ <?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
184
+ jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
185
+ <?php } ?>
186
+
187
+ jQuery('#<?php echo $btn['cow']; ?>_field input').click(function () {
188
+
189
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
190
+
191
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
192
+ data = {
193
+ action: 'remove_tax_wccm',
194
+ tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
195
+ };
196
+
197
+ jQuery.post(ajaxurl, data, function (response) {
198
+ $('body').trigger('update_checkout');
199
+ jQuery('form.checkout').unblock();
200
+ });
201
+
202
+ });
203
+ });
204
+ </script>
205
+ <?php
206
+ }*/
207
+
208
+ /*if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
209
+ ?>
210
+ <script type="text/javascript">
211
+ jQuery(document).ready(function ($) {
212
+
213
+ <?php if (!empty($saved['wooccm_addamount453user'])) { ?>
214
+ jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
215
+ <?php } ?>
216
+ jQuery('#<?php echo $btn['cow']; ?>_field input').click(function () {
217
+
218
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
219
+
220
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
221
+ data = {
222
+ action: 'remove_tax_wccm',
223
+ add_amount_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
224
+ };
225
+
226
+ jQuery.post(ajaxurl, data, function (response) {
227
+ $('body').trigger('update_checkout');
228
+ jQuery('form.checkout').unblock();
229
+ });
230
+
231
+ });
232
+ });
233
+ </script>
234
+ <?php
235
+ }*/
236
 
237
  // =========================================== select options =========================================
238
 
239
+ /*if (($btn['type'] == 'wooccmselect') && !empty($btn['tax_remove'])) {
240
+ ?>
241
+ <script type="text/javascript">
242
+ jQuery(document).ready(function ($) {
243
+
244
+ <?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
245
+ jQuery('#<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_tax_save_method']; ?>');
246
+ <?php } ?>
247
+ jQuery('#<?php echo $btn['cow']; ?>_field select').change(function () {
248
+
249
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
250
+
251
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
252
+ data = {
253
+ action: 'remove_tax_wccm',
254
+ tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
255
+ };
256
+
257
+ jQuery.post(ajaxurl, data, function (response) {
258
+ $('body').trigger('update_checkout');
259
+ jQuery('form.checkout').unblock();
260
+ });
261
+
262
+ });
263
+ });
264
+ </script>
265
+ <?php
266
+ }*/
267
+
268
+ /*if (($btn['type'] == 'wooccmselect') && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
269
+ ?>
270
+ <script type="text/javascript">
271
+ jQuery(document).ready(function ($) {
272
+
273
+ <?php if (!empty($saved['wooccm_addamount453user'])) { ?>
274
+ jQuery('#<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_addamount453user']; ?>');
275
+ <?php } ?>
276
+
277
+ jQuery('#<?php echo $btn['cow']; ?>_field select').change(function () {
278
+
279
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
280
+
281
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
282
+ data = {
283
+ action: 'remove_tax_wccm',
284
+ add_amount_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
285
+ };
286
+
287
+ jQuery.post(ajaxurl, data, function (response) {
288
+ $('body').trigger('update_checkout');
289
+ jQuery('form.checkout').unblock();
290
+ });
291
+
292
+ });
293
+ });
294
+ </script>
295
+ <?php
296
+ }*/
297
 
298
  // =========================================== add apply button ==========================================
299
 
300
+ /*if (($btn['type'] == 'text') && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
301
+ ?>
302
+ <script type="text/javascript">
303
+ jQuery(document).ready(function () {
304
+ jQuery("#<?php echo $btn['cow']; ?>_field").append('<span id="<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply', 'woocommerce-checkout-manager'); ?></span>');
305
+ });
306
 
307
+ jQuery(document).ready(function ($) {
308
 
309
+ <?php if (!empty($saved['wooccm_addamount453userf'])) { ?>
310
+ jQuery('input#<?php echo $btn['cow']; ?>').val('<?php echo $saved['wooccm_addamount453userf']; ?>');
311
+ <?php } ?>
312
 
313
+ jQuery('#<?php echo $btn['cow']; ?>_field #<?php echo $btn['cow']; ?>_applynow').click(function () {
314
 
315
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
316
 
317
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
318
+ data = {
319
+ action: 'remove_tax_wccm',
320
+ add_amount_faj: jQuery('input#<?php echo $btn['cow']; ?>').val()
321
+ };
322
 
323
+ jQuery.post(ajaxurl, data, function (response) {
324
+ $('body').trigger('update_checkout');
325
+ jQuery('form.checkout').unblock();
326
+ });
327
 
328
+ });
329
 
330
+ });
331
+ </script>
332
+ <?php
333
+ }*/
334
 
335
  // =====================================================
336
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  }
 
includes/templates/functions/billing_functions.php CHANGED
@@ -206,7 +206,7 @@ jQuery(document).ready(function() {
206
 
207
  // ============================== radio button & checkbox ===========================================
208
 
209
- if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
210
  ?>
211
  <script type="text/javascript">
212
  jQuery(document).ready(function ($) {
@@ -234,9 +234,9 @@ jQuery(document).ready(function() {
234
  });
235
  </script>
236
  <?php
237
- }
238
 
239
- if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
240
  ?>
241
  <script type="text/javascript">
242
  jQuery(document).ready(function ($) {
@@ -263,11 +263,11 @@ jQuery(document).ready(function() {
263
  });
264
  </script>
265
  <?php
266
- }
267
 
268
  // =========================================== select options =========================================
269
 
270
- if ($btn['type'] == 'wooccmselect' && !empty($btn['tax_remove'])) {
271
  ?>
272
  <script type="text/javascript">
273
  jQuery(document).ready(function ($) {
@@ -294,9 +294,9 @@ jQuery(document).ready(function() {
294
  });
295
  </script>
296
  <?php
297
- }
298
 
299
- if ($btn['type'] == 'wooccmselect' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
300
  ?>
301
  <script type="text/javascript">
302
  jQuery(document).ready(function ($) {
@@ -324,11 +324,11 @@ jQuery(document).ready(function() {
324
  });
325
  </script>
326
  <?php
327
- }
328
 
329
  // =========================================== add apply button ==========================================
330
 
331
- if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
332
  ?>
333
  <script type="text/javascript">
334
  jQuery(document).ready(function () {
@@ -361,253 +361,8 @@ jQuery(document).ready(function() {
361
  });
362
  </script>
363
  <?php
364
- }
365
 
366
  // =====================================================
367
  }
368
  }
369
-
370
- // --------------------------------------------------------
371
- // --------------------------------------------------------
372
- // --------------------------------------------------------
373
-
374
- function wooccm_billing_override_this() {
375
-
376
- global $woocommerce;
377
-
378
- $options = get_option('wccs_settings3');
379
-
380
- $options['billing_buttons'] = ( isset($options['billing_buttons']) ? $options['billing_buttons'] : array() );
381
-
382
- // Check if there are any buttons
383
- if (count($options['billing_buttons']) == 0)
384
- return;
385
-
386
- $i = 0;
387
-
388
- // css sub-parent hide
389
- foreach ($options['billing_buttons'] as $btn) {
390
- if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
391
- echo '
392
- <style type="text/css">
393
- #billing_' . $btn['cow'] . '_applynow {
394
- background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
395
- background: -webkit-linear-gradient(#ad74a2,#96588a);
396
- background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
397
- background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
398
- border-color: #76456c;
399
- color: #fff;
400
- text-shadow: 0 -1px 0 rgba(0,0,0,.6);
401
- width: 100%;
402
- text-align: center;
403
- float: right;
404
- cursor: pointer;
405
- position: relative;
406
- }
407
- #billing_' . $btn['cow'] . '_applynow:active {
408
- top: 1px;
409
- }
410
- </style>';
411
- }
412
- if (!empty($btn['conditional_tie']) && empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use'])) {
413
- echo '
414
- <style type="text/css">
415
- .woocommerce form #customer_details #billing_' . $btn['cow'] . '_field.' . $btn['conditional_tie'] . ',
416
- .woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field.' . $btn['conditional_tie'] . ',
417
- .woocommerce form.checkout #billing_' . $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' {
418
- display: none;
419
- }
420
- </style>';
421
- }
422
- }
423
-
424
- // ====================== CHECKBOX =============================
425
- // script when clicked show
426
- // =============================================================
427
- ?>
428
- <!-- Billing section: Checkbox -->
429
- <script type="text/javascript">
430
- jQuery(document).ready(function ($) {
431
- <?php
432
- foreach ($options['billing_buttons'] as $btn) {
433
- if ($btn['type'] == 'checkbox_wccm') {
434
-
435
- if (!empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) {
436
- ?>
437
-
438
- jQuery("#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]").click(function () {
439
-
440
- <?php
441
- foreach ($options['billing_buttons'] as $btn3) {
442
- if (empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) {
443
- ?>
444
- 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']; ?>') {
445
- jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show("slow");
446
- }
447
- 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']; ?>') {
448
- jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide("slow");
449
-
450
- <?php if (!empty($btn2['fee_name']) && !empty($btn2['add_amount'])) { ?>
451
-
452
- $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
453
-
454
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
455
- data = {
456
- action: 'remove_tax_wccm',
457
- empty_check_add: 'none'
458
- };
459
-
460
- jQuery.post(ajaxurl, data, function (response) {
461
- $('body').trigger('update_checkout');
462
- jQuery('form.checkout').unblock();
463
- });
464
-
465
- <?php } ?>
466
-
467
- }
468
-
469
- <?php
470
- }
471
- }
472
- ?>
473
-
474
- });
475
-
476
- <?php
477
- }
478
- }
479
- }
480
- ?>
481
- });
482
- </script>
483
- <?php
484
- // ================================ END!!! =====================================
485
- // =============================================================================
486
- // ====================== SELECT OPTIONS =============================
487
- // script when clicked show
488
- // =============================================================
489
- ?>
490
- <!-- Billing section: Select options -->
491
- <script type="text/javascript">
492
- jQuery(document).ready(function ($) {
493
-
494
- <?php
495
- foreach ($options['billing_buttons'] as $btn) {
496
- if ($btn['type'] == 'wooccmselect') {
497
-
498
- if (!empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) {
499
- ?>
500
-
501
- jQuery("#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function () {
502
-
503
- <?php
504
- foreach ($options['billing_buttons'] as $btn3) {
505
- if (empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) {
506
- ?>
507
-
508
- if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #billing_' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>') {
509
- jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show("slow");
510
- }
511
-
512
- if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #billing_' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>') {
513
- jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide("slow");
514
-
515
- <?php if (!empty($btn2['fee_name']) && !empty($btn2['add_amount'])) { ?>
516
-
517
- $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
518
-
519
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
520
- data = {
521
- action: 'remove_tax_wccm',
522
- empty_check_add: 'none'
523
- };
524
-
525
- jQuery.post(ajaxurl, data, function (response) {
526
- $('body').trigger('update_checkout');
527
- jQuery('form.checkout').unblock();
528
- });
529
-
530
- <?php } ?>
531
- }
532
- <?php
533
- }
534
- }
535
- ?>
536
- });
537
- <?php
538
- }
539
- }
540
- }
541
- ?>
542
- });
543
- </script>
544
-
545
- <?php
546
- // ================================ END!!! =====================================
547
- // =============================================================================
548
- // ====================== RADIO BUTTON =============================
549
- // script when clicked show
550
- // =============================================================
551
- ?>
552
- <!-- Billing section: Radio buttons -->
553
- <script type="text/javascript">
554
- jQuery(document).ready(function ($) {
555
-
556
- <?php
557
- foreach ($options['billing_buttons'] as $btn) {
558
- if ($btn['type'] == 'wooccmradio') {
559
-
560
- if (!empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) {
561
- ?>
562
-
563
- jQuery("#billing_<?php echo '' . $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input").click(function () {
564
-
565
- <?php
566
- foreach ($options['billing_buttons'] as $btn3) {
567
- if (empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) {
568
- ?>
569
-
570
- 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']; ?>') {
571
- jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show("slow");
572
- }
573
-
574
- 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']; ?>') {
575
- jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide("slow");
576
-
577
- <?php if (!empty($btn2['fee_name']) && !empty($btn2['add_amount'])) { ?>
578
-
579
- $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
580
-
581
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
582
- data = {
583
- action: 'remove_tax_wccm',
584
- empty_check_add: 'none'
585
- };
586
-
587
- jQuery.post(ajaxurl, data, function (response) {
588
- $('body').trigger('update_checkout');
589
- jQuery('form.checkout').unblock();
590
- });
591
-
592
- <?php } ?>
593
-
594
- }
595
-
596
- <?php
597
- }
598
- }
599
- ?>
600
-
601
- });
602
- <?php
603
- }
604
- }
605
- }
606
- ?>
607
- });
608
- </script>
609
-
610
- <?php
611
-
612
- }
613
- ?>
206
 
207
  // ============================== radio button & checkbox ===========================================
208
 
209
+ /*if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
210
  ?>
211
  <script type="text/javascript">
212
  jQuery(document).ready(function ($) {
234
  });
235
  </script>
236
  <?php
237
+ }*/
238
 
239
+ /*if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
240
  ?>
241
  <script type="text/javascript">
242
  jQuery(document).ready(function ($) {
263
  });
264
  </script>
265
  <?php
266
+ }*/
267
 
268
  // =========================================== select options =========================================
269
 
270
+ /*if ($btn['type'] == 'wooccmselect' && !empty($btn['tax_remove'])) {
271
  ?>
272
  <script type="text/javascript">
273
  jQuery(document).ready(function ($) {
294
  });
295
  </script>
296
  <?php
297
+ }*/
298
 
299
+ /*if ($btn['type'] == 'wooccmselect' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
300
  ?>
301
  <script type="text/javascript">
302
  jQuery(document).ready(function ($) {
324
  });
325
  </script>
326
  <?php
327
+ }*/
328
 
329
  // =========================================== add apply button ==========================================
330
 
331
+ /*if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
332
  ?>
333
  <script type="text/javascript">
334
  jQuery(document).ready(function () {
361
  });
362
  </script>
363
  <?php
364
+ }*/
365
 
366
  // =====================================================
367
  }
368
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/templates/functions/shipping_functions.php CHANGED
@@ -2,618 +2,370 @@
2
  /**
3
  * WooCommerce Checkout Manager
4
  */
5
-
6
  // Exit if accessed directly
7
- if ( !defined( 'ABSPATH' ) ) exit;
 
8
 
9
  function wooccm_shipping_hide_required() {
10
 
11
- global $woocommerce;
12
 
13
- $options = get_option( 'wccs_settings2' );
14
 
15
- $billing = array(
16
- 'address_1',
17
- 'address_2',
18
- 'city',
19
- 'state',
20
- 'postcode'
21
- );
22
 
23
- if( !empty( $options['shipping_buttons'] ) ) {
24
- echo '
25
  <style>
26
  ';
27
- foreach( $options['shipping_buttons'] as $btn ) {
28
- if( in_array($btn['cow'], $billing) && empty($btn['checkbox']) ) {
29
- echo '
30
- p#shipping_'.$btn['cow'].'_field .required{
31
  display:none;
32
  }';
33
- }
34
- }
35
- echo '
36
  </style>';
37
- }
38
-
39
  }
40
 
41
  function wooccm_shipping_scripts() {
42
 
43
- global $woocommerce;
44
 
45
- $options = get_option( 'wccs_settings2' );
46
 
47
- if ( WC()->cart->needs_shipping_address() !== true )
48
- return;
49
 
50
- $saved = WC()->session->get( 'wooccm_retain', array() );
51
 
52
- // Check if we have any buttons
53
- if( empty($options['shipping_buttons']) )
54
- return;
55
 
56
- foreach ( $options['shipping_buttons'] as $btn ) {
57
 
58
- if( $btn['type'] == 'datepicker' ) {
59
- echo '
60
  <script type="text/javascript">
61
  jQuery(document).ready(function() {
62
  var today = new Date();
63
  if( jQuery.isFunction(jQuery.fn.datepicker) ) {
64
- jQuery("input#shipping_'.$btn['cow'].'").datepicker({
65
  ';
66
- // Default date format
67
- if( empty($btn['format_date']) )
68
- $btn['format_date'] = apply_filters( 'wooccm_datepicker_default_date_format', 'dd-mm-yy' );
69
- if( !empty($btn['format_date']) ) {
70
- echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
71
- }
72
- if( !empty($btn['single_yy']) ) {
73
- echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
74
- }
75
- if( !empty($btn['min_before']) ) {
76
- echo 'minDate: '.$btn['min_before'].',';
77
- }
78
- if( !empty($btn['single_max_yy']) ) {
79
- echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
80
- }
81
- if( !empty($btn['max_after']) ) {
82
- echo 'maxDate: '.$btn['max_after'].',';
83
- }
84
- if( !empty($btn['days_disabler']) ) {
85
- echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
86
- if( !empty($btn['days_disabler0']) ) {
87
- echo 'day == 0';
88
- } else { echo 'day == "x"'; }
89
- if( !empty($btn['days_disabler1']) ) {
90
- echo ' || day == 1';
91
- }
92
- if( !empty($btn['days_disabler2']) ) {
93
- echo ' || day == 2';
94
- }
95
- if( !empty($btn['days_disabler3']) ) {
96
- echo ' || day == 3';
97
- }
98
- if( !empty($btn['days_disabler4']) ) {
99
- echo ' || day == 4';
100
- }
101
- if( !empty($btn['days_disabler5']) ) {
102
- echo ' || day == 5';
103
- }
104
- if( !empty($btn['days_disabler6']) ) {
105
- echo '|| day == 6';
106
- }
107
- echo ')]; }';
108
- }
109
- do_action( 'wooccm_js_datepicker_shipping_args', $btn );
110
- echo '
 
 
111
  });
112
  }
113
  });
114
  </script>
115
  ';
116
- }
117
 
118
- if( $btn['type'] == 'time' ) {
119
- $args = '
120
  showPeriod: true,';
121
- if( !empty($btn['start_hour']) ) {
122
- $args .= '
123
- hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
124
- }
125
- if( !empty($btn['interval_min']) ) {
126
- $args .= '
127
- minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
128
- }
129
- $args .= '
130
  showLeadingZero: true';
131
- $args = apply_filters( 'wooccm_timepicker_jquery_args', $args, $btn );
132
- echo '
133
  <!-- Shipping section: TimePicker -->
134
  <script type="text/javascript">
135
  jQuery(document).ready(function() {
136
  if( jQuery.isFunction(jQuery.fn.timepicker) ) {
137
- jQuery("#shipping_'.$btn['cow'].'_field input#shipping_'.$btn['cow'].'").timepicker({
138
  ';
139
- echo $args;
140
- echo '
141
  });
142
  }
143
  });
144
  </script>
145
  ';
146
- }
147
 
148
- if ( $btn['type'] == 'password' ) {
149
- echo '
150
  <script type="text/javascript">
151
  jQuery(document).ready(function() {
152
- jQuery("p#shipping_'.$btn['cow'].'_field").css("display");
153
  });
154
  </script>
155
  ';
156
- }
157
-
158
- if( $btn['type'] == 'colorpicker' ) {
159
- switch( $btn['colorpickertype'] ) {
160
-
161
- case 'farbtastic':
162
- ?>
163
- <script type="text/javascript">
164
- jQuery(document).ready(function($) {
165
- jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
166
- if( jQuery.isFunction(jQuery.fn.farbtastic) ) {
167
- jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#shipping_<?php echo $btn['cow']; ?>_colorpicker");
168
- jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
169
- }
170
- });
171
- </script>
172
- <?php
173
- break;
174
-
175
- case 'iris':
176
- ?>
177
- <script type="text/javascript">
178
- jQuery(document).ready(function($) {
179
-
180
- $( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
181
- $( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
182
-
183
- var options = {
184
- wccmclass: "shipping_<?php echo $btn['cow']; ?>_colorpickerdiv",
185
- palettes: true,
186
- color: "",
187
- hide: false,
188
- change: function(event,ui){
189
- $( '#shipping_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
190
- $( '#shipping_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
191
- }
192
- };
193
-
194
- jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpicker').iris( options );
195
- jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
196
- jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
197
-
198
- });
199
- </script>
200
- <?php
201
- break;
202
-
203
- }
204
- }
 
 
 
205
 
206
  // ============================== radio button & checkbox ===========================================
207
 
208
- if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['tax_remove'] ) ) {
209
- ?>
210
- <script type="text/javascript">
211
- jQuery(document).ready(function($) {
212
-
213
- <?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
214
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
215
- <?php } ?>
216
-
217
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function() {
218
-
219
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
220
-
221
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
222
- data = {
223
- action: 'remove_tax_wccm',
224
- tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
225
- };
226
-
227
- jQuery.post(ajaxurl, data, function(response) {
228
- $( 'body' ).trigger( 'update_checkout' );
229
- jQuery('form.checkout').unblock();
230
- });
231
-
232
- });
233
- });
234
- </script>
235
- <?php
236
- }
237
-
238
- if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
239
- ?>
240
- <script type="text/javascript">
241
- jQuery(document).ready(function($) {
242
-
243
- <?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
244
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
245
- <?php } ?>
246
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function() {
247
-
248
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
249
-
250
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
251
- data = {
252
- action: 'remove_tax_wccm',
253
- add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
254
- };
255
-
256
- jQuery.post(ajaxurl, data, function(response) {
257
- $( 'body' ).trigger( 'update_checkout' );
258
- jQuery('form.checkout').unblock();
259
- });
260
-
261
- });
262
- });
263
- </script>
264
- <?php
265
- }
266
 
267
  // =========================================== select options =========================================
268
 
269
- if( $btn['type'] == 'wooccmselect' && !empty( $btn['tax_remove'] ) ) {
270
- ?>
271
- <script type="text/javascript">
272
- jQuery(document).ready(function($) {
273
-
274
- <?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
275
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
276
- <?php } ?>
277
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function() {
278
-
279
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
280
-
281
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
282
- data = {
283
- action: 'remove_tax_wccm',
284
- tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
285
- };
286
-
287
- jQuery.post(ajaxurl, data, function(response) {
288
- $( 'body' ).trigger( 'update_checkout' );
289
- jQuery('form.checkout').unblock();
290
- });
291
-
292
- });
293
- });
294
- </script>
295
- <?php
296
- }
297
-
298
- if( $btn['type'] == 'wooccmselect' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
299
- ?>
300
- <script type="text/javascript">
301
- jQuery(document).ready(function($) {
302
-
303
- <?php if( !empty( $saved['wooccm_addamount453user'] ) ) { ?>
304
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
305
- <?php } ?>
306
-
307
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function() {
308
-
309
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
310
-
311
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
312
- data = {
313
- action: 'remove_tax_wccm',
314
- add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
315
- };
316
-
317
- jQuery.post(ajaxurl, data, function(response) {
318
- $( 'body' ).trigger( 'update_checkout' );
319
- jQuery('form.checkout').unblock();
320
- });
321
-
322
- });
323
- });
324
- </script>
325
- <?php
326
- }
327
 
328
  // =========================================== add apply button ==========================================
329
 
330
- if( $btn['type'] == 'text' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
331
- ?>
332
- <script type="text/javascript">
333
- jQuery(document).ready(function() {
334
- jQuery( "#shipping_<?php echo $btn['cow']; ?>_field" ).append( '<span id="shipping_<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply','woocommerce-checkout-manager'); ?></span>' );
335
- });
336
 
337
- jQuery(document).ready(function($) {
338
 
339
- <?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
340
- jQuery('input#shipping_<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
341
- <?php } ?>
342
 
343
- jQuery('#shipping_<?php echo $btn['cow']; ?>_field #shipping_<?php echo $btn['cow']; ?>_applynow').click(function() {
344
 
345
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
346
 
347
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
348
- data = {
349
- action: 'remove_tax_wccm',
350
- add_amount_faj: jQuery('input#shipping_<?php echo $btn['cow']; ?>').val()
351
- };
352
 
353
- jQuery.post(ajaxurl, data, function(response) {
354
- $( 'body' ).trigger( 'update_checkout' );
355
- jQuery('form.checkout').unblock();
356
- });
357
 
358
- });
359
 
360
- });
361
- </script>
362
- <?php
363
- }
364
 
365
  // =====================================================
366
-
367
- }
368
-
369
- }
370
-
371
- // --------------------------------------------------------
372
- // --------------------------------------------------------
373
- // --------------------------------------------------------
374
-
375
- function wooccm_shipping_override_this() {
376
-
377
- global $woocommerce;
378
-
379
- $options = get_option( 'wccs_settings3' );
380
-
381
- $options['shipping_buttons'] = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : array() );
382
-
383
- // Check if there are any buttons
384
- if ( count( $options['shipping_buttons'] ) == 0 )
385
- return;
386
-
387
- $i = 0;
388
-
389
- // css sub-parent hide
390
- foreach( $options['shipping_buttons'] as $btn ) {
391
- if( $btn['type'] == 'text' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
392
- echo '
393
- <style type="text/css">
394
- #shipping_'.$btn['cow'].'_applynow {
395
- background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
396
- background: -webkit-linear-gradient(#ad74a2,#96588a);
397
- background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
398
- background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
399
- border-color: #76456c;
400
- color: #fff;
401
- text-shadow: 0 -1px 0 rgba(0,0,0,.6);
402
- width: 100%;
403
- text-align: center;
404
- float: right;
405
- cursor: pointer;
406
- position: relative;
407
- }
408
- #shipping_'.$btn['cow'].'_applynow:active {
409
- top: 1px;
410
- }
411
- </style>';
412
- }
413
- if( !empty( $btn['conditional_tie'] ) && empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) ) {
414
- echo '
415
- <style type="text/css">
416
- .woocommerce form #customer_details #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
417
- .woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
418
- .woocommerce form.checkout #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
419
- display: none;
420
- }
421
- </style>';
422
- }
423
- }
424
-
425
- // ====================== CHECKBOX =============================
426
- // script when clicked show
427
- // =============================================================
428
- ?>
429
- <!-- Shipping section: Checkbox -->
430
- <script type="text/javascript">
431
- jQuery(document).ready(function($){
432
- <?php
433
- foreach( $options['shipping_buttons'] as $btn ) {
434
- if( $btn['type'] == 'checkbox_wccm' ) {
435
-
436
- if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
437
- ?>
438
-
439
- jQuery("#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]").click(function(){
440
-
441
- <?php
442
- foreach( $options['shipping_buttons'] as $btn3 ) {
443
- if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
444
- ?>
445
- if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
446
- jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
447
- }
448
- if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
449
- jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
450
-
451
- <?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
452
-
453
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
454
-
455
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
456
- data = {
457
- action: 'remove_tax_wccm',
458
- empty_check_add: 'none'
459
- };
460
-
461
- jQuery.post(ajaxurl, data, function(response) {
462
- $( 'body' ).trigger( 'update_checkout' );
463
- jQuery('form.checkout').unblock();
464
- });
465
-
466
- <?php } ?>
467
-
468
- }
469
-
470
- <?php
471
- }
472
- }
473
- ?>
474
-
475
- });
476
-
477
- <?php
478
- }
479
- }
480
- }
481
- ?>
482
- });
483
- </script>
484
- <?php
485
-
486
- // ================================ END!!! =====================================
487
- // =============================================================================
488
-
489
- // ====================== SELECT OPTIONS =============================
490
- // script when clicked show
491
- // =============================================================
492
- ?>
493
- <!-- Shipping section: Select options -->
494
- <script type="text/javascript">
495
- jQuery(document).ready(function($){
496
-
497
- <?php
498
- foreach( $options['shipping_buttons'] as $btn ) {
499
- if( $btn['type'] == 'wooccmselect' ) {
500
-
501
- if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
502
- ?>
503
-
504
- jQuery("#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function(){
505
-
506
- <?php
507
- foreach( $options['shipping_buttons'] as $btn3 ) {
508
- if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
509
- ?>
510
-
511
- if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #shipping_' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
512
- jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
513
- }
514
-
515
- if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #shipping_' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
516
- jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
517
-
518
- <?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
519
-
520
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
521
-
522
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
523
- data = {
524
- action: 'remove_tax_wccm',
525
- empty_check_add: 'none'
526
- };
527
-
528
- jQuery.post(ajaxurl, data, function(response) {
529
- $( 'body' ).trigger( 'update_checkout' );
530
- jQuery('form.checkout').unblock();
531
- });
532
-
533
- <?php } ?>
534
- }
535
- <?php
536
- }
537
- }
538
- ?>
539
- });
540
- <?php
541
- }
542
- }
543
- }
544
- ?>
545
- });
546
- </script>
547
-
548
- <?php
549
-
550
- // ================================ END!!! =====================================
551
- // =============================================================================
552
-
553
- // ====================== RADIO BUTTON =============================
554
- // script when clicked show
555
- // =============================================================
556
-
557
- ?>
558
- <!-- Shipping section: Radio buttons -->
559
- <script type="text/javascript">
560
- jQuery(document).ready(function($){
561
-
562
- <?php
563
- foreach( $options['shipping_buttons'] as $btn ) {
564
- if( $btn['type'] == 'wooccmradio' ) {
565
-
566
- if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
567
- ?>
568
-
569
- jQuery("#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input").click(function(){
570
-
571
- <?php
572
- foreach( $options['shipping_buttons'] as $btn3 ) {
573
- if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
574
- ?>
575
-
576
- if(jQuery('#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
577
- jQuery("#shipping_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" );
578
- }
579
-
580
- if(jQuery('#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
581
- jQuery("#shipping_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" );
582
-
583
- <?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
584
-
585
- $( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
586
-
587
- var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
588
- data = {
589
- action: 'remove_tax_wccm',
590
- empty_check_add: 'none'
591
- };
592
-
593
- jQuery.post(ajaxurl, data, function(response) {
594
- $( 'body' ).trigger( 'update_checkout' );
595
- jQuery('form.checkout').unblock();
596
- });
597
-
598
- <?php } ?>
599
-
600
- }
601
-
602
- <?php
603
- }
604
- }
605
- ?>
606
-
607
- });
608
- <?php
609
- }
610
- }
611
- }
612
- ?>
613
- });
614
- </script>
615
-
616
- <?php
617
-
618
  }
619
- ?>
2
  /**
3
  * WooCommerce Checkout Manager
4
  */
 
5
  // Exit if accessed directly
6
+ if (!defined('ABSPATH'))
7
+ exit;
8
 
9
  function wooccm_shipping_hide_required() {
10
 
11
+ global $woocommerce;
12
 
13
+ $options = get_option('wccs_settings2');
14
 
15
+ $billing = array(
16
+ 'address_1',
17
+ 'address_2',
18
+ 'city',
19
+ 'state',
20
+ 'postcode'
21
+ );
22
 
23
+ if (!empty($options['shipping_buttons'])) {
24
+ echo '
25
  <style>
26
  ';
27
+ foreach ($options['shipping_buttons'] as $btn) {
28
+ if (in_array($btn['cow'], $billing) && empty($btn['checkbox'])) {
29
+ echo '
30
+ p#shipping_' . $btn['cow'] . '_field .required{
31
  display:none;
32
  }';
33
+ }
34
+ }
35
+ echo '
36
  </style>';
37
+ }
 
38
  }
39
 
40
  function wooccm_shipping_scripts() {
41
 
42
+ global $woocommerce;
43
 
44
+ $options = get_option('wccs_settings2');
45
 
46
+ if (WC()->cart->needs_shipping_address() !== true)
47
+ return;
48
 
49
+ $saved = WC()->session->get('wooccm_retain', array());
50
 
51
+ // Check if we have any buttons
52
+ if (empty($options['shipping_buttons']))
53
+ return;
54
 
55
+ foreach ($options['shipping_buttons'] as $btn) {
56
 
57
+ if ($btn['type'] == 'datepicker') {
58
+ echo '
59
  <script type="text/javascript">
60
  jQuery(document).ready(function() {
61
  var today = new Date();
62
  if( jQuery.isFunction(jQuery.fn.datepicker) ) {
63
+ jQuery("input#shipping_' . $btn['cow'] . '").datepicker({
64
  ';
65
+ // Default date format
66
+ if (empty($btn['format_date']))
67
+ $btn['format_date'] = apply_filters('wooccm_datepicker_default_date_format', 'dd-mm-yy');
68
+ if (!empty($btn['format_date'])) {
69
+ echo 'dateFormat : "' . str_replace(' ', '', $btn['format_date']) . '",';
70
+ }
71
+ if (!empty($btn['single_yy'])) {
72
+ echo 'minDate: new Date( ' . $btn['single_yy'] . ', ' . $btn['single_mm'] . ' - 1, ' . $btn['single_dd'] . '),';
73
+ }
74
+ if (!empty($btn['min_before'])) {
75
+ echo 'minDate: ' . $btn['min_before'] . ',';
76
+ }
77
+ if (!empty($btn['single_max_yy'])) {
78
+ echo 'maxDate: new Date( ' . $btn['single_max_yy'] . ', ' . $btn['single_max_mm'] . ' - 1, ' . $btn['single_max_dd'] . '),';
79
+ }
80
+ if (!empty($btn['max_after'])) {
81
+ echo 'maxDate: ' . $btn['max_after'] . ',';
82
+ }
83
+ if (!empty($btn['days_disabler'])) {
84
+ echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
85
+ if (!empty($btn['days_disabler0'])) {
86
+ echo 'day == 0';
87
+ } else {
88
+ echo 'day == "x"';
89
+ }
90
+ if (!empty($btn['days_disabler1'])) {
91
+ echo ' || day == 1';
92
+ }
93
+ if (!empty($btn['days_disabler2'])) {
94
+ echo ' || day == 2';
95
+ }
96
+ if (!empty($btn['days_disabler3'])) {
97
+ echo ' || day == 3';
98
+ }
99
+ if (!empty($btn['days_disabler4'])) {
100
+ echo ' || day == 4';
101
+ }
102
+ if (!empty($btn['days_disabler5'])) {
103
+ echo ' || day == 5';
104
+ }
105
+ if (!empty($btn['days_disabler6'])) {
106
+ echo '|| day == 6';
107
+ }
108
+ echo ')]; }';
109
+ }
110
+ do_action('wooccm_js_datepicker_shipping_args', $btn);
111
+ echo '
112
  });
113
  }
114
  });
115
  </script>
116
  ';
117
+ }
118
 
119
+ if ($btn['type'] == 'time') {
120
+ $args = '
121
  showPeriod: true,';
122
+ if (!empty($btn['start_hour'])) {
123
+ $args .= '
124
+ hours: { starts: ' . $btn['start_hour'] . ', ends: ' . $btn['end_hour'] . ' },';
125
+ }
126
+ if (!empty($btn['interval_min'])) {
127
+ $args .= '
128
+ minutes: {interval: ' . $btn['interval_min'] . ', manual: [' . $btn['manual_min'] . '] },';
129
+ }
130
+ $args .= '
131
  showLeadingZero: true';
132
+ $args = apply_filters('wooccm_timepicker_jquery_args', $args, $btn);
133
+ echo '
134
  <!-- Shipping section: TimePicker -->
135
  <script type="text/javascript">
136
  jQuery(document).ready(function() {
137
  if( jQuery.isFunction(jQuery.fn.timepicker) ) {
138
+ jQuery("#shipping_' . $btn['cow'] . '_field input#shipping_' . $btn['cow'] . '").timepicker({
139
  ';
140
+ echo $args;
141
+ echo '
142
  });
143
  }
144
  });
145
  </script>
146
  ';
147
+ }
148
 
149
+ if ($btn['type'] == 'password') {
150
+ echo '
151
  <script type="text/javascript">
152
  jQuery(document).ready(function() {
153
+ jQuery("p#shipping_' . $btn['cow'] . '_field").css("display");
154
  });
155
  </script>
156
  ';
157
+ }
158
+
159
+ if ($btn['type'] == 'colorpicker') {
160
+ switch ($btn['colorpickertype']) {
161
+
162
+ case 'farbtastic':
163
+ ?>
164
+ <script type="text/javascript">
165
+ jQuery(document).ready(function ($) {
166
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
167
+ if (jQuery.isFunction(jQuery.fn.farbtastic)) {
168
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#shipping_<?php echo $btn['cow']; ?>_colorpicker");
169
+ jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
170
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
171
+ });
172
+ }
173
+ });
174
+ </script>
175
+ <?php
176
+ break;
177
+
178
+ case 'iris':
179
+ ?>
180
+ <script type="text/javascript">
181
+ jQuery(document).ready(function ($) {
182
+
183
+ $('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#fff');
184
+ $('#<?php echo $btn['cow']; ?>_colorpicker').css('background', '<?php echo $btn['colorpickerd']; ?>');
185
+
186
+ var options = {
187
+ wccmclass: "shipping_<?php echo $btn['cow']; ?>_colorpickerdiv",
188
+ palettes: true,
189
+ color: "",
190
+ hide: false,
191
+ change: function (event, ui) {
192
+ $('#shipping_<?php echo $btn['cow']; ?>_colorpicker').css('color', '#000');
193
+ $('#shipping_<?php echo $btn['cow']; ?>_colorpicker').css('background', ui.color.toString());
194
+ }
195
+ };
196
+
197
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpicker').iris(options);
198
+ jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
199
+ jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
200
+ jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
201
+ });
202
+
203
+ });
204
+ </script>
205
+ <?php
206
+ break;
207
+ }
208
+ }
209
 
210
  // ============================== radio button & checkbox ===========================================
211
 
212
+ /* if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
213
+ ?>
214
+ <script type="text/javascript">
215
+ jQuery(document).ready(function ($) {
216
+
217
+ <?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
218
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
219
+ <?php } ?>
220
+
221
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function () {
222
+
223
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
224
+
225
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
226
+ data = {
227
+ action: 'remove_tax_wccm',
228
+ tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
229
+ };
230
+
231
+ jQuery.post(ajaxurl, data, function (response) {
232
+ $('body').trigger('update_checkout');
233
+ jQuery('form.checkout').unblock();
234
+ });
235
+
236
+ });
237
+ });
238
+ </script>
239
+ <?php
240
+ } */
241
+
242
+ /* if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
243
+ ?>
244
+ <script type="text/javascript">
245
+ jQuery(document).ready(function ($) {
246
+
247
+ <?php if (!empty($saved['wooccm_addamount453user'])) { ?>
248
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
249
+ <?php } ?>
250
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function () {
251
+
252
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
253
+
254
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
255
+ data = {
256
+ action: 'remove_tax_wccm',
257
+ add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
258
+ };
259
+
260
+ jQuery.post(ajaxurl, data, function (response) {
261
+ $('body').trigger('update_checkout');
262
+ jQuery('form.checkout').unblock();
263
+ });
264
+
265
+ });
266
+ });
267
+ </script>
268
+ <?php
269
+ } */
270
 
271
  // =========================================== select options =========================================
272
 
273
+ /* if ($btn['type'] == 'wooccmselect' && !empty($btn['tax_remove'])) {
274
+ ?>
275
+ <script type="text/javascript">
276
+ jQuery(document).ready(function ($) {
277
+
278
+ <?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
279
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_tax_save_method']; ?>');
280
+ <?php } ?>
281
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function () {
282
+
283
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
284
+
285
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
286
+ data = {
287
+ action: 'remove_tax_wccm',
288
+ tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
289
+ };
290
+
291
+ jQuery.post(ajaxurl, data, function (response) {
292
+ $('body').trigger('update_checkout');
293
+ jQuery('form.checkout').unblock();
294
+ });
295
+
296
+ });
297
+ });
298
+ </script>
299
+ <?php
300
+ } */
301
+
302
+ /* if ($btn['type'] == 'wooccmselect' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
303
+ ?>
304
+ <script type="text/javascript">
305
+ jQuery(document).ready(function ($) {
306
+
307
+ <?php if (!empty($saved['wooccm_addamount453user'])) { ?>
308
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_addamount453user']; ?>');
309
+ <?php } ?>
310
+
311
+ jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function () {
312
+
313
+ $('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
314
+
315
+ var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
316
+ data = {
317
+ action: 'remove_tax_wccm',
318
+ add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
319
+ };
320
+
321
+ jQuery.post(ajaxurl, data, function (response) {
322
+ $('body').trigger('update_checkout');
323
+ jQuery('form.checkout').unblock();
324
+ });
325
+
326
+ });
327
+ });
328
+ </script>
329
+ <?php
330
+ } */
331
 
332
  // =========================================== add apply button ==========================================
333
 
334
+ /* if ($btn['type'] == 'text