WooCommerce Checkout Manager - Version 4.3.9

Version Description

  • Fix: woocommerce checkout multiple options
  • Fix: woocommerce checkout roles dependency
Download this release

Release Info

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

Code changes from version 4.3.8 to 4.3.9

assets/js/wooccm-admin.js CHANGED
@@ -2,20 +2,19 @@
2
 
3
  // Toggle gateway on/off.
4
  $('#wooccm_billing_settings_add').on('click', function () {
5
-
6
- var $link = $(this),
7
- $row = $link.closest('tr'),
8
- $toggle = $link.find('.woocommerce-input-toggle');
 
 
 
9
 
10
  var data = {
11
  action: 'wooccm_add_field',
12
  nonce: wooccm.nonce,
13
- //field_id: $row.data('field_id')
14
  };
15
-
16
- console.log(data);
17
-
18
- $toggle.addClass('woocommerce-input-toggle--loading');
19
 
20
  $.ajax({
21
  url: woocommerce_admin.ajax_url,
@@ -23,8 +22,6 @@
23
  dataType: 'json',
24
  type: 'POST',
25
  success: function (response) {
26
-
27
- console.log(response);
28
 
29
  if (true === response.data) {
30
  //$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
@@ -44,13 +41,13 @@
44
  $('#wooccm_billing_fields').on('click', '.wooccm-field-toggle-enabled', function () {
45
 
46
  var $link = $(this),
47
- $row = $link.closest('tr'),
48
  $toggle = $link.find('.woocommerce-input-toggle');
49
 
50
  var data = {
51
  action: 'wooccm_toggle_field_enabled',
52
  nonce: wooccm.nonce,
53
- field_id: $row.data('field_id')
54
  };
55
 
56
  $toggle.addClass('woocommerce-input-toggle--loading');
2
 
3
  // Toggle gateway on/off.
4
  $('#wooccm_billing_settings_add').on('click', function () {
5
+
6
+ var $button = $(this),
7
+ $table = $('table#wooccm_billing_fields'),
8
+ $tr = $table.find('tbody > tr'),
9
+ $new = $tr.last().clone();
10
+
11
+ // $table.find('tbody').append($new);
12
 
13
  var data = {
14
  action: 'wooccm_add_field',
15
  nonce: wooccm.nonce,
16
+ //field_id: $tr.data('field_id')
17
  };
 
 
 
 
18
 
19
  $.ajax({
20
  url: woocommerce_admin.ajax_url,
22
  dataType: 'json',
23
  type: 'POST',
24
  success: function (response) {
 
 
25
 
26
  if (true === response.data) {
27
  //$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
41
  $('#wooccm_billing_fields').on('click', '.wooccm-field-toggle-enabled', function () {
42
 
43
  var $link = $(this),
44
+ $tr = $link.closest('tr'),
45
  $toggle = $link.find('.woocommerce-input-toggle');
46
 
47
  var data = {
48
  action: 'wooccm_toggle_field_enabled',
49
  nonce: wooccm.nonce,
50
+ field_id: $tr.data('field_id')
51
  };
52
 
53
  $toggle.addClass('woocommerce-input-toggle--loading');
assets/js/wooccm-admin.min.js CHANGED
@@ -1 +1 @@
1
- (function(a){a("#wooccm_billing_settings_add").on("click",function(){var c=a(this),b=c.closest("tr"),d=c.find(".woocommerce-input-toggle");var e={action:"wooccm_add_field",nonce:wooccm.nonce,};console.log(e);d.addClass("woocommerce-input-toggle--loading");a.ajax({url:woocommerce_admin.ajax_url,data:e,dataType:"json",type:"POST",success:function(f){console.log(f);if(true===f.data){}else{if(true!==f.data){}}}});return false});a("#wooccm_billing_fields").on("click",".wooccm-field-toggle-enabled",function(){var c=a(this),b=c.closest("tr"),d=c.find(".woocommerce-input-toggle");var e={action:"wooccm_toggle_field_enabled",nonce:wooccm.nonce,field_id:b.data("field_id")};d.addClass("woocommerce-input-toggle--loading");a.ajax({url:woocommerce_admin.ajax_url,data:e,dataType:"json",type:"POST",success:function(f){if(true===f.data){d.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");d.addClass("woocommerce-input-toggle--enabled");d.removeClass("woocommerce-input-toggle--loading")}else{if(true!==f.data){d.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");d.addClass("woocommerce-input-toggle--disabled");d.removeClass("woocommerce-input-toggle--loading")}}}});return false})})(jQuery);
1
+ (function(a){a("#wooccm_billing_settings_add").on("click",function(){var f=a(this),b=a("table#wooccm_billing_fields"),c=b.find("tbody > tr"),e=c.last().clone();var d={action:"wooccm_add_field",nonce:wooccm.nonce,};a.ajax({url:woocommerce_admin.ajax_url,data:d,dataType:"json",type:"POST",success:function(g){if(true===g.data){}else{if(true!==g.data){}}}});return false});a("#wooccm_billing_fields").on("click",".wooccm-field-toggle-enabled",function(){var b=a(this),d=b.closest("tr"),c=b.find(".woocommerce-input-toggle");var e={action:"wooccm_toggle_field_enabled",nonce:wooccm.nonce,field_id:d.data("field_id")};c.addClass("woocommerce-input-toggle--loading");a.ajax({url:woocommerce_admin.ajax_url,data:e,dataType:"json",type:"POST",success:function(f){if(true===f.data){c.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");c.addClass("woocommerce-input-toggle--enabled");c.removeClass("woocommerce-input-toggle--loading")}else{if(true!==f.data){c.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");c.addClass("woocommerce-input-toggle--disabled");c.removeClass("woocommerce-input-toggle--loading")}}}});return false})})(jQuery);
new/admin.php CHANGED
@@ -16,13 +16,13 @@ if (!class_exists('WOOCCM_Admin')) {
16
 
17
  if (array_key_exists('billing_buttons', $options)) {
18
 
19
- $enabled = empty($options['billing_buttons'][$field_id]['enabled']);
20
 
21
- $options['billing_buttons'][$field_id]['enabled'] = $enabled;
22
 
23
  update_option('wccs_settings3', $options);
24
 
25
- wp_send_json_success($enabled);
26
  }
27
  }
28
  }
@@ -40,9 +40,13 @@ if (!class_exists('WOOCCM_Admin')) {
40
  if (array_key_exists('billing_buttons', $options)) {
41
 
42
  $options['billing_buttons'][] = array(
43
- 'order' => '',
44
- 'label' => 'test',
45
- 'placeholder' => 'test'
 
 
 
 
46
  );
47
 
48
  update_option('wccs_settings3', $options);
16
 
17
  if (array_key_exists('billing_buttons', $options)) {
18
 
19
+ $disabled = empty($options['billing_buttons'][$field_id]['disabled']);
20
 
21
+ $options['billing_buttons'][$field_id]['disabled'] = $disabled;
22
 
23
  update_option('wccs_settings3', $options);
24
 
25
+ wp_send_json_success(!$disabled);
26
  }
27
  }
28
  }
40
  if (array_key_exists('billing_buttons', $options)) {
41
 
42
  $options['billing_buttons'][] = array(
43
+ 'order' => count($options['billing_buttons']) + 1,
44
+ 'label' => esc_html__('New Field', 'woocommerce-checkout-manager'),
45
+ 'placeholder' => esc_html__('New Field', 'woocommerce-checkout-manager'),
46
+ 'position' => 'form-row-wide',
47
+ 'required' => false,
48
+ 'clear_row' => false,
49
+ 'type' => 'wooccmtext'
50
  );
51
 
52
  update_option('wccs_settings3', $options);
new/admin/pages/billing.php CHANGED
@@ -21,7 +21,7 @@
21
  <th class="status"><?php esc_html_e('Enabled', 'woocommerce-checkout-manager'); ?></th>
22
  <th class="label"><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></th>
23
  <th class="placeholder"><?php esc_html_e('Placeholder', 'woocommerce-checkout-manager'); ?></th>
24
- <!--<th class="order"><?php esc_html_e('Order', 'woocommerce-checkout-manager'); ?></th>-->
25
  <th class="required"><?php esc_html_e('Required', 'woocommerce-checkout-manager'); ?></th>
26
  <th class="position"><?php esc_html_e('Position', 'woocommerce-checkout-manager'); ?></th>
27
  <th class="clear"><?php esc_html_e('Clear', 'woocommerce-checkout-manager'); ?></th>
@@ -53,7 +53,7 @@
53
  <td class="status" width="1%" style="width: 51px;">
54
  <a class="wooccm-field-toggle-enabled" href="#">
55
  <?php
56
- if (!empty($custom_field['enabled'])) {
57
  /* Translators: %s Payment gateway name. */
58
  echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" payment method is currently enabled', 'woocommerce-checkout-manager'), @$custom_field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
59
  } else {
@@ -69,9 +69,9 @@
69
  <td class="placeholder" width="" style="max-width: 152px;">
70
  <?php echo esc_html(@$custom_field['placeholder']); ?>
71
  </td>
72
- <!--<td class="order">
73
  <strong><?php echo esc_html(@$custom_field['order']); ?></strong>
74
- </td>-->
75
  <td class="required">
76
  <?php echo esc_html(@$custom_field['checkbox']); ?>
77
  </td>
21
  <th class="status"><?php esc_html_e('Enabled', 'woocommerce-checkout-manager'); ?></th>
22
  <th class="label"><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></th>
23
  <th class="placeholder"><?php esc_html_e('Placeholder', 'woocommerce-checkout-manager'); ?></th>
24
+ <th class="order"><?php esc_html_e('Order', 'woocommerce-checkout-manager'); ?></th>
25
  <th class="required"><?php esc_html_e('Required', 'woocommerce-checkout-manager'); ?></th>
26
  <th class="position"><?php esc_html_e('Position', 'woocommerce-checkout-manager'); ?></th>
27
  <th class="clear"><?php esc_html_e('Clear', 'woocommerce-checkout-manager'); ?></th>
53
  <td class="status" width="1%" style="width: 51px;">
54
  <a class="wooccm-field-toggle-enabled" href="#">
55
  <?php
56
+ if (empty($custom_field['disabled'])) {
57
  /* Translators: %s Payment gateway name. */
58
  echo '<span class="woocommerce-input-toggle woocommerce-input-toggle--enabled" aria-label="' . esc_attr(sprintf(__('The "%s" payment method is currently enabled', 'woocommerce-checkout-manager'), @$custom_field['label'])) . '">' . esc_attr__('Yes', 'woocommerce-checkout-manager') . '</span>';
59
  } else {
69
  <td class="placeholder" width="" style="max-width: 152px;">
70
  <?php echo esc_html(@$custom_field['placeholder']); ?>
71
  </td>
72
+ <td class="order">
73
  <strong><?php echo esc_html(@$custom_field['order']); ?></strong>
74
+ </td>
75
  <td class="required">
76
  <?php echo esc_html(@$custom_field['checkbox']); ?>
77
  </td>
new/fields_handler.php CHANGED
@@ -7,7 +7,7 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
7
  protected static $instance;
8
  protected static $i = 0;
9
 
10
- /*function field_user_roles($field, $key, $args, $value) {
11
 
12
  global $current_user;
13
 
@@ -17,25 +17,32 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
17
 
18
  if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
19
 
20
- $rolekeys = explode('||', $args['role_options']);
21
 
22
- $rolekeys2 = explode('||', $args['role_options2']);
23
 
24
- if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
25
- return;
26
- }
27
 
28
- if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
29
- return;
30
- }
31
  }
32
 
33
  return $field;
34
- }*/
35
 
36
  function remove_checkout_fields($fields) {
37
 
 
 
 
 
 
 
38
  foreach ($fields as $key => $type) {
 
39
  foreach ($type as $id => $field) {
40
 
41
  // Remove disabled
@@ -76,7 +83,7 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
76
  }
77
 
78
  function init() {
79
-
80
  // Remove fields
81
  // -----------------------------------------------------------------------
82
  add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
@@ -84,7 +91,7 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
84
  // Fix address_2 field
85
  // -----------------------------------------------------------------------
86
  add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
87
-
88
  //add_filter('woocommerce_form_field', array($this, 'field_user_roles'), 10, 4);
89
  }
90
 
7
  protected static $instance;
8
  protected static $i = 0;
9
 
10
+ /* function field_user_roles($field, $key, $args, $value) {
11
 
12
  global $current_user;
13
 
17
 
18
  if (!empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2']))) {
19
 
20
+ $rolekeys = explode('||', $args['role_options']);
21
 
22
+ $rolekeys2 = explode('||', $args['role_options2']);
23
 
24
+ if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
25
+ return;
26
+ }
27
 
28
+ if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
29
+ return;
30
+ }
31
  }
32
 
33
  return $field;
34
+ } */
35
 
36
  function remove_checkout_fields($fields) {
37
 
38
+ global $current_user;
39
+
40
+ $user_roles = $current_user->roles;
41
+
42
+ $user_role = array_shift($user_roles);
43
+
44
  foreach ($fields as $key => $type) {
45
+
46
  foreach ($type as $id => $field) {
47
 
48
  // Remove disabled
83
  }
84
 
85
  function init() {
86
+
87
  // Remove fields
88
  // -----------------------------------------------------------------------
89
  add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
91
  // Fix address_2 field
92
  // -----------------------------------------------------------------------
93
  add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
94
+
95
  //add_filter('woocommerce_form_field', array($this, 'field_user_roles'), 10, 4);
96
  }
97
 
new/fields_register.php CHANGED
@@ -48,10 +48,10 @@ if (!class_exists('WOOCCM_Fields_Register')) {
48
 
49
  // Options
50
  // -----------------------------------------------------------------------
51
- if (isset($custom_field['force_title2'])) {
52
- $fields[$key]['option'] = $fields[$key]['force_title2'];
53
- }
54
-
55
  // Default
56
  // -----------------------------------------------------------------------
57
  if (isset($custom_field['force_title2'])) {
@@ -60,8 +60,6 @@ if (!class_exists('WOOCCM_Fields_Register')) {
60
 
61
  // Clear
62
  // -----------------------------------------------------------------------
63
- //var_dump($fields[$key]);
64
-
65
  if (isset($custom_field['clear_row'])) {
66
  $fields[$key]['clear'] = $fields[$key]['clear_row'];
67
  }
@@ -93,15 +91,13 @@ if (!class_exists('WOOCCM_Fields_Register')) {
93
  if ($custom_field['cow'] !== 'country' || $custom_field['cow'] !== 'state') {
94
  $fields[$key]['placeholder'] = ( isset($custom_field['placeholder']) ? $custom_field['placeholder'] : '' );
95
  }
96
-
97
- //var_dump($fields[$key]);
98
-
99
  // Scape wooccm field fielter
100
  // -----------------------------------------------------------------------
101
  if ($fields[$key]['type'] == 'wooccmtext') {
102
  $fields[$key]['type'] = 'text';
103
  }
104
-
105
  if ($fields[$key]['type'] == 'wooccmstate') {
106
  $fields[$key]['type'] = 'state';
107
  }
@@ -121,13 +117,17 @@ if (!class_exists('WOOCCM_Fields_Register')) {
121
  $fields[$key]['wooccm_required'] = false;
122
  }
123
 
124
- //echo ($key . '//' . intval($fields[$key]['required']));
125
  // Remove required for heading
126
  // -----------------------------------------------------------------------
127
  if ($custom_field['type'] == 'heading') {
128
  $fields[$key]['required'] = false;
129
  }
130
 
 
 
 
 
 
131
  // Check if Multi-checkbox has options assigned to it
132
  // -----------------------------------------------------------------------
133
  if ($custom_field['type'] == 'multicheckbox' && empty($custom_field['option_array'])) {
@@ -160,6 +160,8 @@ if (!class_exists('WOOCCM_Fields_Register')) {
160
  }
161
  }
162
 
 
 
163
  return $fields[$key];
164
  }
165
 
@@ -224,15 +226,15 @@ if (!class_exists('WOOCCM_Fields_Register')) {
224
  }
225
 
226
  function init() {
227
-
228
  // Billing fields
229
  // -----------------------------------------------------------------------
230
  add_filter('woocommerce_billing_fields', array($this, 'add_checkout_billing_fields'));
231
-
232
  // Shipping fields
233
  // -----------------------------------------------------------------------
234
  add_filter('woocommerce_shipping_fields', array($this, 'add_checkout_shipping_fields'));
235
-
236
  // Additional fields
237
  // -----------------------------------------------------------------------
238
  switch ($this->get_positioning()) {
48
 
49
  // Options
50
  // -----------------------------------------------------------------------
51
+ //if (!empty($custom_field['option_array'])) {
52
+ $fields[$key]['options'] = @$custom_field['option_array'];
53
+ //}
54
+
55
  // Default
56
  // -----------------------------------------------------------------------
57
  if (isset($custom_field['force_title2'])) {
60
 
61
  // Clear
62
  // -----------------------------------------------------------------------
 
 
63
  if (isset($custom_field['clear_row'])) {
64
  $fields[$key]['clear'] = $fields[$key]['clear_row'];
65
  }
91
  if ($custom_field['cow'] !== 'country' || $custom_field['cow'] !== 'state') {
92
  $fields[$key]['placeholder'] = ( isset($custom_field['placeholder']) ? $custom_field['placeholder'] : '' );
93
  }
94
+
 
 
95
  // Scape wooccm field fielter
96
  // -----------------------------------------------------------------------
97
  if ($fields[$key]['type'] == 'wooccmtext') {
98
  $fields[$key]['type'] = 'text';
99
  }
100
+
101
  if ($fields[$key]['type'] == 'wooccmstate') {
102
  $fields[$key]['type'] = 'state';
103
  }
117
  $fields[$key]['wooccm_required'] = false;
118
  }
119
 
 
120
  // Remove required for heading
121
  // -----------------------------------------------------------------------
122
  if ($custom_field['type'] == 'heading') {
123
  $fields[$key]['required'] = false;
124
  }
125
 
126
+ // Fancy
127
+ // -----------------------------------------------------------------------
128
+ //if (!empty($custom_field['option_array'])) {
129
+ $fields[$key]['fancy'] = @$custom_field['fancy'];
130
+ //}
131
  // Check if Multi-checkbox has options assigned to it
132
  // -----------------------------------------------------------------------
133
  if ($custom_field['type'] == 'multicheckbox' && empty($custom_field['option_array'])) {
160
  }
161
  }
162
 
163
+ //error_log(json_encode($fields[$key]));
164
+
165
  return $fields[$key];
166
  }
167
 
226
  }
227
 
228
  function init() {
229
+
230
  // Billing fields
231
  // -----------------------------------------------------------------------
232
  add_filter('woocommerce_billing_fields', array($this, 'add_checkout_billing_fields'));
233
+
234
  // Shipping fields
235
  // -----------------------------------------------------------------------
236
  add_filter('woocommerce_shipping_fields', array($this, 'add_checkout_shipping_fields'));
237
+
238
  // Additional fields
239
  // -----------------------------------------------------------------------
240
  switch ($this->get_positioning()) {
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.0
6
  Tested up to: 5.2.3
7
- Stable tag: 4.3.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -137,6 +137,10 @@ Example:
137
 
138
  == Changelog ==
139
 
 
 
 
 
140
  = 4.3.8 =
141
  * Fix: woocommerce checkout beta admin panel removed
142
 
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
+ Stable tag: 4.3.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
137
 
138
  == Changelog ==
139
 
140
+ = 4.3.9 =
141
+ * Fix: woocommerce checkout multiple options
142
+ * Fix: woocommerce checkout roles dependency
143
+
144
  = 4.3.8 =
145
  * Fix: woocommerce checkout beta admin panel removed
146
 
woocommerce-checkout-manager.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WooCommerce Checkout Manager
4
  * Description: Manages WooCommerce Checkout, the advanced way.
5
- * Version: 4.3.8
6
  * Author: QuadLayers
7
  * Author URI: https://www.quadlayers.com
8
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
@@ -16,7 +16,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
16
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
17
  }
18
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
19
- define('WOOCCM_PLUGIN_VERSION', '4.3.8');
20
  }
21
  if (!defined('WOOCCM_PLUGIN_FILE')) {
22
  define('WOOCCM_PLUGIN_FILE', __FILE__);
2
  /**
3
  * Plugin Name: WooCommerce Checkout Manager
4
  * Description: Manages WooCommerce Checkout, the advanced way.
5
+ * Version: 4.3.9
6
  * Author: QuadLayers
7
  * Author URI: https://www.quadlayers.com
8
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
16
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
17
  }
18
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
19
+ define('WOOCCM_PLUGIN_VERSION', '4.3.9');
20
  }
21
  if (!defined('WOOCCM_PLUGIN_FILE')) {
22
  define('WOOCCM_PLUGIN_FILE', __FILE__);