WooCommerce Checkout Manager - Version 4.9.9

Version Description

  • Fix: woocommerce checkout multiselect default values
  • Fix: woocommerce checkout multicheckbox default values
  • Fix: woocommerce checkout checkbox default values
Download this release

Release Info

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

Code changes from version 4.9.8 to 4.9.9

includes/view/frontend/class-wooccm-fields-filters.php CHANGED
@@ -83,7 +83,7 @@ class WOOCCM_Fields_Filter {
83
  $field .= ' <span class="woocommerce-radio-wrapper" ' . implode(' ', $custom_attributes) . '>';
84
 
85
  foreach ($args['options'] as $option_key => $option_text) {
86
- $field .= '<input type="radio" class="input-checkbox" value="' . esc_attr($option_key) . '" name="' . esc_attr($key) . '" id="' . esc_attr($key) . '_' . esc_attr($option_key) . '"' . checked($value, $option_key, false) . ' />';
87
  $field .= '<label for="' . esc_attr($key) . '_' . esc_attr($option_key) . '" class="checkbox ' . implode(' ', $args['label_class']) . '">' . $option_text . '</label><br>';
88
  }
89
 
@@ -102,7 +102,7 @@ class WOOCCM_Fields_Filter {
102
  $field .= '<option value="" disabled="disabled" selected="selected">' . esc_attr($args['placeholder']) . '</option>';
103
  }
104
  foreach ($args['options'] as $option_key => $option_text) {
105
- $field .= '<option value="' . esc_attr($option_key) . '" ' . selected($value, $option_key, false) . '>' . esc_attr($option_text) . '</option>';
106
  }
107
  $field .= '</select>';
108
  }
@@ -113,12 +113,12 @@ class WOOCCM_Fields_Filter {
113
 
114
  $field = '';
115
 
116
- $value = is_array($value) ? $value : array($value);
117
 
118
  if (!empty($args['options'])) {
119
  $field .= '<select name="' . esc_attr($key) . '[]" id="' . esc_attr($key) . '" class="select ' . esc_attr(implode(' ', $args['input_class'])) . '" multiple="multiple" ' . implode(' ', $custom_attributes) . '>';
120
  foreach ($args['options'] as $option_key => $option_text) {
121
- $field .= '<option value="' . esc_attr($option_key) . '" ' . selected(in_array($option_key, $value), 1, false) . '>' . esc_attr($option_text) . '</option>';
122
  }
123
  $field .= ' </select>';
124
  }
@@ -129,7 +129,7 @@ class WOOCCM_Fields_Filter {
129
 
130
  $field = '';
131
 
132
- $value = is_array($value) ? $value : array($value);
133
 
134
  if (!empty($args['options'])) {
135
 
@@ -137,7 +137,7 @@ class WOOCCM_Fields_Filter {
137
 
138
  foreach ($args['options'] as $option_key => $option_text) {
139
  //$field .='<label><input type="checkbox" name="' . esc_attr($key) . '[]" value="1"' . checked(in_array($option_key, $value), 1, false) . ' /> ' . esc_attr($option_text) . '</label>';
140
- $field .='<label><input type="checkbox" name="' . esc_attr($key) . '[]" value="' . esc_attr($option_key) . '"' . checked(in_array($option_key, $value), 1, false) . ' /> ' . esc_attr($option_text) . '</label>';
141
  }
142
 
143
  $field .= '</span>';
83
  $field .= ' <span class="woocommerce-radio-wrapper" ' . implode(' ', $custom_attributes) . '>';
84
 
85
  foreach ($args['options'] as $option_key => $option_text) {
86
+ $field .= '<input type="radio" class="input-checkbox" value="' . esc_attr($option_text) . '" name="' . esc_attr($key) . '" id="' . esc_attr($key) . '_' . esc_attr($option_key) . '"' . checked($value, $option_text, false) . ' />';
87
  $field .= '<label for="' . esc_attr($key) . '_' . esc_attr($option_key) . '" class="checkbox ' . implode(' ', $args['label_class']) . '">' . $option_text . '</label><br>';
88
  }
89
 
102
  $field .= '<option value="" disabled="disabled" selected="selected">' . esc_attr($args['placeholder']) . '</option>';
103
  }
104
  foreach ($args['options'] as $option_key => $option_text) {
105
+ $field .= '<option value="' . esc_attr($option_text) . '" ' . selected($value, $option_text, false) . '>' . esc_attr($option_text) . '</option>';
106
  }
107
  $field .= '</select>';
108
  }
113
 
114
  $field = '';
115
 
116
+ $value = is_array($value) ? $value : array_map('trim', (array) explode(',', $value));
117
 
118
  if (!empty($args['options'])) {
119
  $field .= '<select name="' . esc_attr($key) . '[]" id="' . esc_attr($key) . '" class="select ' . esc_attr(implode(' ', $args['input_class'])) . '" multiple="multiple" ' . implode(' ', $custom_attributes) . '>';
120
  foreach ($args['options'] as $option_key => $option_text) {
121
+ $field .= '<option value="' . esc_attr($option_text) . '" ' . selected(in_array($option_text, $value), 1, false) . '>' . esc_attr($option_text) . '</option>';
122
  }
123
  $field .= ' </select>';
124
  }
129
 
130
  $field = '';
131
 
132
+ $value = is_array($value) ? $value : array_map('trim', (array) explode(',', $value));
133
 
134
  if (!empty($args['options'])) {
135
 
137
 
138
  foreach ($args['options'] as $option_key => $option_text) {
139
  //$field .='<label><input type="checkbox" name="' . esc_attr($key) . '[]" value="1"' . checked(in_array($option_key, $value), 1, false) . ' /> ' . esc_attr($option_text) . '</label>';
140
+ $field .= '<label><input type="checkbox" name="' . esc_attr($key) . '[]" value="' . esc_attr($option_text) . '"' . checked(in_array($option_text, $value), 1, false) . ' /> ' . esc_attr($option_text) . '</label>';
141
  }
142
 
143
  $field .= '</span>';
includes/view/frontend/class-wooccm-fields-handler.php CHANGED
@@ -20,30 +20,21 @@ class WOOCCM_Fields_Handler {
20
  if (count($fields = WC()->session->wooccm['fields'])) {
21
 
22
  foreach ($fields as $key => $field) {
23
-
24
  switch ($field['type']) {
25
 
26
- case 'select':
27
- case 'radio':
28
- case 'multiselect':
29
  case 'multicheckbox':
30
 
31
- if (isset($_POST[$key]) && is_array($field['options'])) {
32
-
33
- // use $_POST because $data is converted to string only in multiselect
34
- if ($values = (array) $_POST[$key]) {
35
 
36
- $names = array();
37
-
38
- foreach ($values as $id) {
39
 
40
- if (isset($field['options'][$id])) {
41
- $names[] = $field['options'][$id];
42
- }
43
 
44
- $data[$key] = join(', ', (array) $names);
45
- }
46
- }
 
47
  }
48
 
49
  break;
20
  if (count($fields = WC()->session->wooccm['fields'])) {
21
 
22
  foreach ($fields as $key => $field) {
23
+
24
  switch ($field['type']) {
25
 
 
 
 
26
  case 'multicheckbox':
27
 
28
+ $data[$key] = isset($_POST[$key]) ? implode(', ', wc_clean(wp_unslash($_POST[$key]))) : '';
 
 
 
29
 
30
+ break;
 
 
31
 
32
+ case 'checkbox':
 
 
33
 
34
+ if (!empty($_POST[$key])) {
35
+ $data[$key] = __('Yes', 'woocommerce-checkout-manager');
36
+ } else {
37
+ $data[$key] = __('No', 'woocommerce-checkout-manager');
38
  }
39
 
40
  break;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 3.4
6
  Tested up to: 5.4.0
7
- Stable tag: 4.9.8
8
  WC requires at least: 3.0
9
  WC tested up to: 4.0
10
  License: GPLv2 or later
@@ -107,6 +107,11 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = 4.9.8 =
111
  * Fix: woocommerce checkout manager premium compatibility
112
 
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 3.4
6
  Tested up to: 5.4.0
7
+ Stable tag: 4.9.9
8
  WC requires at least: 3.0
9
  WC tested up to: 4.0
10
  License: GPLv2 or later
107
 
108
  == Changelog ==
109
 
110
+ = 4.9.9 =
111
+ * Fix: woocommerce checkout multiselect default values
112
+ * Fix: woocommerce checkout multicheckbox default values
113
+ * Fix: woocommerce checkout checkbox default values
114
+
115
  = 4.9.8 =
116
  * Fix: woocommerce checkout manager premium compatibility
117
 
woocommerce-checkout-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
- * Version: 4.9.8
7
  * Author: QuadLayers
8
  * Author URI: https://www.quadlayers.com
9
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
@@ -17,7 +17,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
17
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
18
  }
19
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
20
- define('WOOCCM_PLUGIN_VERSION', '4.9.8');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
+ * Version: 4.9.9
7
  * Author: QuadLayers
8
  * Author URI: https://www.quadlayers.com
9
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
17
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
18
  }
19
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
20
+ define('WOOCCM_PLUGIN_VERSION', '4.9.9');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);