WooCommerce Checkout Manager - Version 4.2.4

Version Description

  • Fixed: Checkout field sorting issue in WC 3.5.1 onwards (thanks all)
Download this release

Release Info

Developer visser
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 4.2.4
Comparing to
See all releases

Code changes from version 4.2.3 to 4.2.4

includes/checkout-billing.php CHANGED
@@ -31,9 +31,8 @@ function wooccm_checkout_billing_fields( $fields = array() ) {
31
  $fields[$key]['type'] = $btn['type'];
32
  }
33
 
34
- if( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) {
35
  $fields[$key]['placeholder'] = ( isset( $btn['placeholder'] ) ? $btn['placeholder'] : '' );
36
- }
37
 
38
  // Default to Position wide
39
  $btn['position'] = ( isset( $btn['position'] ) ? $btn['position'] : 'form-row-wide' );
@@ -51,12 +50,12 @@ function wooccm_checkout_billing_fields( $fields = array() ) {
51
  $fields[$key]['color'] = ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' );
52
  $fields[$key]['colorpickertype'] = ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' );
53
  $fields[$key]['order'] = ( isset( $btn['order'] ) ? $btn['order'] : '' );
 
54
  $fields[$key]['fancy'] = ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' );
55
 
56
  // Check if Multi-checkbox has options assigned to it
57
- if( $btn['type'] == 'multicheckbox' && empty( $btn['option_array'] ) ) {
58
  $btn['disabled'] = true;
59
- }
60
 
61
  // Bolt on address-field for address-based fields
62
  if( in_array( $btn['cow'], $billing ) )
@@ -80,9 +79,8 @@ function wooccm_checkout_billing_fields( $fields = array() ) {
80
  }
81
 
82
  // Remove disabled fields
83
- if( !empty( $btn['disabled'] ) ) {
84
  unset( $fields[$key] );
85
- }
86
 
87
  }
88
 
@@ -91,9 +89,8 @@ function wooccm_checkout_billing_fields( $fields = array() ) {
91
  // Resort the fields by order
92
  $fields[] = uasort( $fields, 'wooccm_sort_fields' );
93
 
94
- if( $fields[0] ) {
95
  unset( $fields[0] );
96
- }
97
 
98
  return $fields;
99
 
31
  $fields[$key]['type'] = $btn['type'];
32
  }
33
 
34
+ if( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' )
35
  $fields[$key]['placeholder'] = ( isset( $btn['placeholder'] ) ? $btn['placeholder'] : '' );
 
36
 
37
  // Default to Position wide
38
  $btn['position'] = ( isset( $btn['position'] ) ? $btn['position'] : 'form-row-wide' );
50
  $fields[$key]['color'] = ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' );
51
  $fields[$key]['colorpickertype'] = ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' );
52
  $fields[$key]['order'] = ( isset( $btn['order'] ) ? $btn['order'] : '' );
53
+ $fields[$key]['priority'] = ( isset( $btn['priority'] ) ? $btn['priority'] : $fields[$key]['order'] );
54
  $fields[$key]['fancy'] = ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' );
55
 
56
  // Check if Multi-checkbox has options assigned to it
57
+ if( $btn['type'] == 'multicheckbox' && empty( $btn['option_array'] ) )
58
  $btn['disabled'] = true;
 
59
 
60
  // Bolt on address-field for address-based fields
61
  if( in_array( $btn['cow'], $billing ) )
79
  }
80
 
81
  // Remove disabled fields
82
+ if( !empty( $btn['disabled'] ) )
83
  unset( $fields[$key] );
 
84
 
85
  }
86
 
89
  // Resort the fields by order
90
  $fields[] = uasort( $fields, 'wooccm_sort_fields' );
91
 
92
+ if( $fields[0] )
93
  unset( $fields[0] );
 
94
 
95
  return $fields;
96
 
includes/checkout-shipping.php CHANGED
@@ -31,9 +31,8 @@ function wooccm_checkout_shipping_fields( $fields = array() ) {
31
  $fields[$key]['type'] = $btn['type'];
32
  }
33
 
34
- if( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) {
35
  $fields[$key]['placeholder'] = ( isset( $btn['placeholder'] ) ? $btn['placeholder'] : '' );
36
- }
37
 
38
  // Default to Position wide
39
  $btn['position'] = ( isset( $btn['position'] ) ? $btn['position'] : 'form-row-wide' );
@@ -51,21 +50,20 @@ function wooccm_checkout_shipping_fields( $fields = array() ) {
51
  $fields[$key]['color'] = ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' );
52
  $fields[$key]['colorpickertype'] = ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' );
53
  $fields[$key]['order'] = ( isset( $btn['order'] ) ? $btn['order'] : '' );
 
54
  $fields[$key]['fancy'] = ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' );
55
 
56
  // Check if Multi-checkbox has options assigned to it
57
- if( $btn['type'] == 'multicheckbox' && empty( $btn['option_array'] ) ) {
58
  $btn['disabled'] = true;
59
- }
60
 
61
  // Bolt on address-field for address-based fields
62
  if( in_array( $btn['cow'], $shipping ) )
63
  $fields[$key]['class'][] = 'address-field';
64
 
65
  // Remove disabled fields
66
- if( !empty( $btn['disabled'] ) ) {
67
  unset( $fields[$key] );
68
- }
69
 
70
  }
71
 
@@ -74,9 +72,8 @@ function wooccm_checkout_shipping_fields( $fields = array() ) {
74
  // Resort the fields by order
75
  $fields[] = uasort( $fields, 'wooccm_sort_fields' );
76
 
77
- if( $fields[0] ) {
78
  unset( $fields[0] );
79
- }
80
 
81
  return $fields;
82
 
31
  $fields[$key]['type'] = $btn['type'];
32
  }
33
 
34
+ if( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' )
35
  $fields[$key]['placeholder'] = ( isset( $btn['placeholder'] ) ? $btn['placeholder'] : '' );
 
36
 
37
  // Default to Position wide
38
  $btn['position'] = ( isset( $btn['position'] ) ? $btn['position'] : 'form-row-wide' );
50
  $fields[$key]['color'] = ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' );
51
  $fields[$key]['colorpickertype'] = ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' );
52
  $fields[$key]['order'] = ( isset( $btn['order'] ) ? $btn['order'] : '' );
53
+ $fields[$key]['priority'] = ( isset( $btn['priority'] ) ? $btn['priority'] : $fields[$key]['order'] );
54
  $fields[$key]['fancy'] = ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' );
55
 
56
  // Check if Multi-checkbox has options assigned to it
57
+ if( $btn['type'] == 'multicheckbox' && empty( $btn['option_array'] ) )
58
  $btn['disabled'] = true;
 
59
 
60
  // Bolt on address-field for address-based fields
61
  if( in_array( $btn['cow'], $shipping ) )
62
  $fields[$key]['class'][] = 'address-field';
63
 
64
  // Remove disabled fields
65
+ if( !empty( $btn['disabled'] ) )
66
  unset( $fields[$key] );
 
67
 
68
  }
69
 
72
  // Resort the fields by order
73
  $fields[] = uasort( $fields, 'wooccm_sort_fields' );
74
 
75
+ if( $fields[0] )
76
  unset( $fields[0] );
 
77
 
78
  return $fields;
79
 
includes/checkout.php CHANGED
@@ -19,19 +19,25 @@ function wooccm_checkout_additional_positioning() {
19
 
20
  }
21
 
22
- function wooccm_checkout_default_address_fields( $fields ) {
23
 
24
  // Billing fields
25
  $options = get_option( 'wccs_settings3' );
26
  $buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
27
- if( !empty( $buttons ) ) {
28
- foreach( $buttons as $btn ) {
29
- if( !empty( $btn['cow'] ) && empty( $btn['deny_checkout'] ) ) {
30
- $key = $btn['cow'];
31
- if( isset( $fields[$key] ) )
32
- $fields[$key]['required'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : ( isset( $fields[$key]['required'] ) ? $fields[$key]['required'] : false ) );
33
- }
 
 
 
 
 
34
  }
 
35
  }
36
 
37
  return $fields;
@@ -468,7 +474,7 @@ function wooccm_custom_checkout_field_process() {
468
 
469
  }
470
 
471
- function wooccm_remove_fields_filter_billing( $fields ) {
472
 
473
  global $woocommerce;
474
 
@@ -495,11 +501,12 @@ function wooccm_remove_fields_filter_billing( $fields ) {
495
  }
496
 
497
  }
 
498
  return $fields;
499
 
500
  }
501
 
502
- function wooccm_remove_fields_filter_shipping( $fields ) {
503
 
504
  global $woocommerce;
505
 
@@ -515,12 +522,16 @@ function wooccm_remove_fields_filter_shipping( $fields ) {
515
  $multiCategoriesArrayx = explode(',',$multiCategoriesx);
516
  $_product = $values['data'];
517
 
518
- if( ($woocommerce->cart->cart_contents_count > 1) && ($_product->needs_shipping()) ){
519
- remove_filter('woocommerce_checkout_fields','wooccm_remove_fields_filter',15);
 
 
 
520
  break;
521
  }
522
 
523
  }
 
524
  return $fields;
525
 
526
  }
19
 
20
  }
21
 
22
+ function wooccm_checkout_default_address_fields( $fields = array() ) {
23
 
24
  // Billing fields
25
  $options = get_option( 'wccs_settings3' );
26
  $buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
27
+
28
+ if( empty( $buttons ) )
29
+ return $fields;
30
+
31
+ foreach( $buttons as $btn ) {
32
+
33
+ if( !empty( $btn['cow'] ) && empty( $btn['deny_checkout'] ) ) {
34
+ $key = $btn['cow'];
35
+
36
+ if( isset( $fields[$key] ) )
37
+ $fields[$key]['required'] = ( isset( $btn['checkbox'] ) ? absint( $btn['checkbox'] ) : ( isset( $fields[$key]['required'] ) ? absint( $fields[$key]['required'] ) : false ) );
38
+
39
  }
40
+
41
  }
42
 
43
  return $fields;
474
 
475
  }
476
 
477
+ function wooccm_remove_fields_filter_billing( $fields = array() ) {
478
 
479
  global $woocommerce;
480
 
501
  }
502
 
503
  }
504
+
505
  return $fields;
506
 
507
  }
508
 
509
+ function wooccm_remove_fields_filter_shipping( $fields = array() ) {
510
 
511
  global $woocommerce;
512
 
522
  $multiCategoriesArrayx = explode(',',$multiCategoriesx);
523
  $_product = $values['data'];
524
 
525
+ if(
526
+ ( $woocommerce->cart->cart_contents_count > 1 ) &&
527
+ ( $_product->needs_shipping() )
528
+ ) {
529
+ remove_filter( 'woocommerce_checkout_fields', 'wooccm_remove_fields_filter', 15 );
530
  break;
531
  }
532
 
533
  }
534
+
535
  return $fields;
536
 
537
  }
includes/classes/main.php CHANGED
@@ -708,19 +708,20 @@ function wooccm_woocommerce_delivery_notes_compat( $fields, $order ) {
708
 
709
  }
710
 
711
- function wooccm_order_notes( $fields ) {
712
 
713
  $options = get_option( 'wccs_settings' );
714
 
715
- if( !empty($options['checkness']['noteslabel']) ) {
716
  $fields['order']['order_comments']['label'] = $options['checkness']['noteslabel'];
717
  }
718
- if( !empty($options['checkness']['notesplaceholder']) ) {
719
  $fields['order']['order_comments']['placeholder'] = $options['checkness']['notesplaceholder'];
720
  }
721
- if( !empty($options['checkness']['notesenable']) ) {
722
  unset($fields['order']['order_comments']);
723
  }
 
724
  return $fields;
725
 
726
  }
708
 
709
  }
710
 
711
+ function wooccm_order_notes( $fields = array() ) {
712
 
713
  $options = get_option( 'wccs_settings' );
714
 
715
+ if( !empty( $options['checkness']['noteslabel'] ) ) {
716
  $fields['order']['order_comments']['label'] = $options['checkness']['noteslabel'];
717
  }
718
+ if( !empty( $options['checkness']['notesplaceholder'] ) ) {
719
  $fields['order']['order_comments']['placeholder'] = $options['checkness']['notesplaceholder'];
720
  }
721
+ if( !empty( $options['checkness']['notesenable'] ) ) {
722
  unset($fields['order']['order_comments']);
723
  }
724
+
725
  return $fields;
726
 
727
  }
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: visser, visser.labs, Emark
4
  Donate link: https://www.visser.com.au/donations/
5
  Tags: woocommerce, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
6
  Requires at least: 3.0
7
- Tested up to: 4.9.6
8
- Stable tag: 4.2.3
9
  License: GPLv2 or later
10
 
11
  Manages WooCommerce Checkout, the advanced way.
@@ -135,6 +135,9 @@ Example:
135
 
136
  == Changelog ==
137
 
 
 
 
138
  = 4.2.3 =
139
  * Changed: Hide translation notice in error log
140
  * Changed: Removed excess characters from required field notice
4
  Donate link: https://www.visser.com.au/donations/
5
  Tags: woocommerce, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
6
  Requires at least: 3.0
7
+ Tested up to: 5.0.2
8
+ Stable tag: 4.2.4
9
  License: GPLv2 or later
10
 
11
  Manages WooCommerce Checkout, the advanced way.
135
 
136
  == Changelog ==
137
 
138
+ = 4.2.4 =
139
+ * Fixed: Checkout field sorting issue in WC 3.5.1 onwards (thanks all)
140
+
141
  = 4.2.3 =
142
  * Changed: Hide translation notice in error log
143
  * Changed: Removed excess characters from required field notice
woocommerce-checkout-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WooCommerce Checkout Manager
4
  Plugin URI: https://wordpress.org/plugins/woocommerce-checkout-manager/
5
  Description: Manages WooCommerce Checkout, the advanced way.
6
- Version: 4.2.3
7
  Author: Visser Labs
8
  Author URI: http://www.visser.com.au
9
  Contributors: visser, Emark
@@ -13,7 +13,7 @@ Text Domain: woocommerce-checkout-manager
13
  Domain Path: /languages/
14
 
15
  WC requires at least: 2.3
16
- WC tested up to: 3.4
17
  */
18
 
19
  /*
@@ -95,7 +95,7 @@ add_action( 'wp_head','wooccm_display_front' );
95
  add_action( 'wp_head','wooccm_billing_hide_required' );
96
  add_action( 'wp_head','wooccm_shipping_hide_required' );
97
  // @mod - wooccm_run_color_inner does not exist
98
- // add_action( 'wooccm_run_color_innerpicker','wooccm_run_color_inner'); run color inside options page (proto)
99
  add_action( 'woocommerce_before_checkout_form', 'wooccm_override_this' );
100
  add_filter( 'woocommerce_billing_fields', 'wooccm_checkout_billing_fields' );
101
  add_filter( 'woocommerce_default_address_fields', 'wooccm_checkout_default_address_fields' );
@@ -114,14 +114,14 @@ add_action( 'woocommerce_checkout_process', 'wooccm_custom_checkout_process' );
114
  add_action( 'woocommerce_checkout_process', 'wooccm_billing_custom_checkout_process' );
115
  add_action( 'woocommerce_checkout_process', 'wooccm_shipping_custom_checkout_process' );
116
 
117
- add_action( 'woocommerce_before_checkout_form', 'wooccm_upload_billing_scripts');
118
- add_action( 'woocommerce_before_checkout_form', 'wooccm_upload_shipping_scripts');
119
- add_action( 'woocommerce_before_checkout_form', 'wooccm_billing_scripts');
120
- add_action( 'woocommerce_before_checkout_form', 'wooccm_shipping_scripts');
121
- add_action( 'woocommerce_before_checkout_form', 'wooccm_billing_override_this');
122
- add_action( 'woocommerce_before_checkout_form', 'wooccm_shipping_override_this');
123
- add_action( 'woocommerce_before_checkout_form', 'wooccm_scripts');
124
- add_action( 'woocommerce_before_checkout_form', 'wooccm_upload_scripts');
125
 
126
  add_action( 'woocommerce_checkout_fields', 'wooccm_order_notes' );
127
  add_filter( 'parse_query', 'wooccm_query_list' );
@@ -153,16 +153,16 @@ switch( wooccm_checkout_additional_positioning() ) {
153
 
154
  if( wooccm_validator_changename() ) {
155
 
156
- add_action('woocommerce_before_cart', 'wooccm_before_checkout');
157
- add_action('woocommerce_admin_order_data_after_order_details', 'wooccm_before_checkout');
158
- add_action('woocommerce_before_my_account', 'wooccm_before_checkout');
159
- add_action('woocommerce_email_header', 'wooccm_before_checkout');
160
- add_action('woocommerce_before_checkout_form', 'wooccm_before_checkout');
161
- add_action('woocommerce_after_cart', 'wooccm_after_checkout');
162
- add_action('woocommerce_admin_order_data_after_shipping_address', 'wooccm_after_checkout');
163
- add_action('woocommerce_after_my_account', 'wooccm_after_checkout');
164
- add_action('woocommerce_email_footer', 'wooccm_after_checkout');
165
- add_action('woocommerce_after_checkout_form', 'wooccm_after_checkout');
166
 
167
  }
168
 
@@ -235,7 +235,7 @@ function wooccm_jquery_init() {
235
  wp_enqueue_style( 'farbtastic' );
236
  wp_enqueue_script( 'farbtastic', admin_url( '/js/farbtastic.js' ) );
237
 
238
- wp_enqueue_style('dashicons');
239
 
240
  wp_enqueue_style( 'magnific-popup', plugins_url( 'includes/pickers/magnificpopup/dist/magnific-popup.css', WOOCCM_RELPATH ) );
241
  wp_enqueue_script( 'magnific-popup', plugins_url( 'includes/pickers/magnificpopup/dist/jquery.magnific-popup.js', WOOCCM_RELPATH ) );
3
  Plugin Name: WooCommerce Checkout Manager
4
  Plugin URI: https://wordpress.org/plugins/woocommerce-checkout-manager/
5
  Description: Manages WooCommerce Checkout, the advanced way.
6
+ Version: 4.2.4
7
  Author: Visser Labs
8
  Author URI: http://www.visser.com.au
9
  Contributors: visser, Emark
13
  Domain Path: /languages/
14
 
15
  WC requires at least: 2.3
16
+ WC tested up to: 3.5.3
17
  */
18
 
19
  /*
95
  add_action( 'wp_head','wooccm_billing_hide_required' );
96
  add_action( 'wp_head','wooccm_shipping_hide_required' );
97
  // @mod - wooccm_run_color_inner does not exist
98
+ // add_action( 'wooccm_run_color_innerpicker', 'wooccm_run_color_inner' ); run color inside options page (proto)
99
  add_action( 'woocommerce_before_checkout_form', 'wooccm_override_this' );
100
  add_filter( 'woocommerce_billing_fields', 'wooccm_checkout_billing_fields' );
101
  add_filter( 'woocommerce_default_address_fields', 'wooccm_checkout_default_address_fields' );
114
  add_action( 'woocommerce_checkout_process', 'wooccm_billing_custom_checkout_process' );
115
  add_action( 'woocommerce_checkout_process', 'wooccm_shipping_custom_checkout_process' );
116
 
117
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_upload_billing_scripts' );
118
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_upload_shipping_scripts' );
119
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_billing_scripts' );
120
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_shipping_scripts' );
121
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_billing_override_this' );
122
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_shipping_override_this' );
123
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_scripts' );
124
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_upload_scripts' );
125
 
126
  add_action( 'woocommerce_checkout_fields', 'wooccm_order_notes' );
127
  add_filter( 'parse_query', 'wooccm_query_list' );
153
 
154
  if( wooccm_validator_changename() ) {
155
 
156
+ add_action( 'woocommerce_before_cart', 'wooccm_before_checkout' );
157
+ add_action( 'woocommerce_admin_order_data_after_order_details', 'wooccm_before_checkout' );
158
+ add_action( 'woocommerce_before_my_account', 'wooccm_before_checkout' );
159
+ add_action( 'woocommerce_email_header', 'wooccm_before_checkout' );
160
+ add_action( 'woocommerce_before_checkout_form', 'wooccm_before_checkout' );
161
+ add_action( 'woocommerce_after_cart', 'wooccm_after_checkout' );
162
+ add_action( 'woocommerce_admin_order_data_after_shipping_address', 'wooccm_after_checkout' );
163
+ add_action( 'woocommerce_after_my_account', 'wooccm_after_checkout' );
164
+ add_action( 'woocommerce_email_footer', 'wooccm_after_checkout' );
165
+ add_action( 'woocommerce_after_checkout_form', 'wooccm_after_checkout' );
166
 
167
  }
168
 
235
  wp_enqueue_style( 'farbtastic' );
236
  wp_enqueue_script( 'farbtastic', admin_url( '/js/farbtastic.js' ) );
237
 
238
+ wp_enqueue_style( 'dashicons' );
239
 
240
  wp_enqueue_style( 'magnific-popup', plugins_url( 'includes/pickers/magnificpopup/dist/magnific-popup.css', WOOCCM_RELPATH ) );
241
  wp_enqueue_script( 'magnific-popup', plugins_url( 'includes/pickers/magnificpopup/dist/jquery.magnific-popup.js', WOOCCM_RELPATH ) );