WooCommerce Checkout Manager - Version 6.1.1

Version Description

Download this release

Release Info

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

Code changes from version 6.1.0 to 6.1.1

includes/view/frontend/class-wooccm-fields-additional.php CHANGED
@@ -1,133 +1,131 @@
1
  <?php
2
 
3
- class WOOCCM_Fields_Additional
4
- {
5
-
6
- protected static $_instance;
7
-
8
- public function __construct()
9
- {
10
-
11
- add_action('woocommerce_checkout_process', array($this, 'add_required_notice'));
12
-
13
- // Compatibility
14
- // -----------------------------------------------------------------------
15
- add_filter('default_option_wooccm_additional_position', array($this, 'position'));
16
-
17
- // Additional fields
18
- // -----------------------------------------------------------------------
19
-
20
- switch (get_option('wooccm_additional_position', 'before_order_notes')) {
21
-
22
- case 'before_billing_form':
23
- add_action('woocommerce_before_checkout_billing_form', array($this, 'add_additional_fields'));
24
- break;
25
-
26
- case 'after_billing_form':
27
- add_action('woocommerce_after_checkout_billing_form', array($this, 'add_additional_fields'));
28
- break;
29
-
30
- case 'before_order_notes':
31
- add_action('woocommerce_before_order_notes', array($this, 'add_additional_fields'));
32
- break;
33
-
34
- case 'after_order_notes':
35
- add_action('woocommerce_after_order_notes', array($this, 'add_additional_fields'));
36
- break;
37
- }
38
- }
39
-
40
- public static function instance()
41
- {
42
- if (is_null(self::$_instance)) {
43
- self::$_instance = new self();
44
- }
45
- return self::$_instance;
46
- }
47
-
48
- function add_required_notice()
49
- {
50
-
51
- if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
52
-
53
- foreach ($fields as $key => $field) {
54
-
55
- if (!empty($field['required']) && empty($field['disabled']) && !isset($_POST[$key])) {
56
-
57
- $message = sprintf(esc_html__('%s is a required field.', 'woocommerce-checkout-manager'), '<strong>' . esc_html($field['label']) . '</strong>');
58
-
59
- wc_add_notice($message, 'error');
60
- }
61
- }
62
- }
63
- }
64
-
65
- // function add_order_meta($order_id = 0, $data) {
66
- //
67
- // if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
68
- //
69
- // foreach ($fields as $key => $field) {
70
- //
71
- // if (!empty($data[$key])) {
72
- //
73
- // $value = $data[$key];
74
- //
75
- // if ($field['type'] == 'textarea') {
76
- // update_post_meta($order_id, sprintf('_%s', $key), wp_kses($value, false));
77
- // } else if (is_array($value)) {
78
- // update_post_meta($order_id, sprintf('_%s', $key), implode(',', array_map('sanitize_text_field', $value)));
79
- // } else {
80
- // update_post_meta($order_id, sprintf('_%s', $key), sanitize_text_field($value));
81
- // }
82
- // }
83
- // }
84
- // }
85
- // }
86
-
87
- function add_additional_fields($checkout)
88
- {
89
- ?>
90
- <div class="wooccm-additional-fields">
91
- <?php
92
- if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
93
-
94
- foreach ($fields as $key => $field) {
95
-
96
- if (empty($field['disabled'])) {
97
-
98
- woocommerce_form_field($key, $field, $checkout->get_value($key));
99
- }
100
- }
101
- }
102
- ?>
103
- <div class="wooccm-clearfix"></div>
104
- </div>
105
- <?php
106
- }
107
 
108
- function position($position = 'before_order_notes')
109
- {
 
 
 
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
- $options = get_option('wccs_settings');
 
 
 
113
 
114
- if (!empty($options['checkness']['position'])) {
115
 
116
- $positon = sanitize_text_field($options['checkness']['position']);
117
 
118
- switch ($position) {
119
- case 'before_shipping_form':
120
- $position = 'after_billing_form';
121
- break;
122
 
123
- case 'after_shipping_form':
124
- $position = 'before_order_notes';
125
- break;
126
- }
127
- }
128
 
129
- return $position;
130
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
 
133
  WOOCCM_Fields_Additional::instance();
1
  <?php
2
 
3
+ class WOOCCM_Fields_Additional {
4
+
5
+
6
+ protected static $_instance;
7
+
8
+ public function __construct() {
9
+ add_action( 'woocommerce_checkout_process', array( $this, 'add_required_notice' ) );
10
+
11
+ // Compatibility
12
+ // -----------------------------------------------------------------------
13
+ add_filter( 'default_option_wooccm_additional_position', array( $this, 'position' ) );
14
+
15
+ // Additional fields
16
+ // -----------------------------------------------------------------------
17
+
18
+ switch ( get_option( 'wooccm_additional_position', 'before_order_notes' ) ) {
19
+
20
+ case 'before_billing_form':
21
+ add_action( 'woocommerce_before_checkout_billing_form', array( $this, 'add_additional_fields' ) );
22
+ break;
23
+
24
+ case 'after_billing_form':
25
+ add_action( 'woocommerce_after_checkout_billing_form', array( $this, 'add_additional_fields' ) );
26
+ break;
27
+
28
+ case 'before_order_notes':
29
+ add_action( 'woocommerce_before_order_notes', array( $this, 'add_additional_fields' ) );
30
+ break;
31
+
32
+ case 'after_order_notes':
33
+ add_action( 'woocommerce_after_order_notes', array( $this, 'add_additional_fields' ) );
34
+ break;
35
+ }
36
+ }
37
+
38
+ public static function instance() {
39
+ if ( is_null( self::$_instance ) ) {
40
+ self::$_instance = new self();
41
+ }
42
+ return self::$_instance;
43
+ }
44
+
45
+ function add_required_notice() {
46
+
47
+ $fields = WC()->checkout->get_checkout_fields();
48
+
49
+ if ( ! empty( $fields['additional'] ) ) {
50
+
51
+ foreach ( $fields['additional'] as $key => $field ) {
52
+
53
+ if ( ! empty( $field['required'] ) && empty( $field['disabled'] ) && ! isset( $_POST[ $key ] ) ) {
54
+
55
+ $message = sprintf( esc_html__( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . esc_html( $field['label'] ) . '</strong>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
+ wc_add_notice( $message, 'error' );
58
+ }
59
+ }
60
+ }
61
+ }
62
 
63
+ // function add_order_meta($order_id = 0, $data) {
64
+ //
65
+ // if (count($fields = WC()->checkout->get_checkout_fields('additional'))) {
66
+ //
67
+ // foreach ($fields as $key => $field) {
68
+ //
69
+ // if (!empty($data[$key])) {
70
+ //
71
+ // $value = $data[$key];
72
+ //
73
+ // if ($field['type'] == 'textarea') {
74
+ // update_post_meta($order_id, sprintf('_%s', $key), wp_kses($value, false));
75
+ // } else if (is_array($value)) {
76
+ // update_post_meta($order_id, sprintf('_%s', $key), implode(',', array_map('sanitize_text_field', $value)));
77
+ // } else {
78
+ // update_post_meta($order_id, sprintf('_%s', $key), sanitize_text_field($value));
79
+ // }
80
+ // }
81
+ // }
82
+ // }
83
+ // }
84
 
85
+ function add_additional_fields( $checkout ) {
86
+ ?>
87
+ <div class="wooccm-additional-fields">
88
+ <?php
89
 
90
+ $fields = WC()->checkout->get_checkout_fields();
91
 
92
+ if ( ! empty( $fields['additional'] ) ) {
93
 
94
+ foreach ( $fields['additional'] as $key => $field ) {
 
 
 
95
 
96
+ if ( empty( $field['disabled'] ) ) {
 
 
 
 
97
 
98
+ woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
99
+ }
100
+ }
101
+ }
102
+ ?>
103
+ <div class="wooccm-clearfix"></div>
104
+ </div>
105
+ <?php
106
+ }
107
+
108
+ function position( $position = 'before_order_notes' ) {
109
+
110
+ $options = get_option( 'wccs_settings' );
111
+
112
+ if ( ! empty( $options['checkness']['position'] ) ) {
113
+
114
+ $positon = sanitize_text_field( $options['checkness']['position'] );
115
+
116
+ switch ( $position ) {
117
+ case 'before_shipping_form':
118
+ $position = 'after_billing_form';
119
+ break;
120
+
121
+ case 'after_shipping_form':
122
+ $position = 'before_order_notes';
123
+ break;
124
+ }
125
+ }
126
+
127
+ return $position;
128
+ }
129
  }
130
 
131
  WOOCCM_Fields_Additional::instance();
includes/view/frontend/class-wooccm-fields-i18n.php CHANGED
@@ -67,9 +67,11 @@ class WOOCCM_Fields_i18n {
67
  pll_register_string( $field['description'], $field['description'], $name );
68
  }
69
 
70
- foreach ( $field['options'] as $option_data ) {
71
- if ( isset( $field['options'] ) ) {
72
- pll_register_string( $option_data['label'], $option_data['label'], sprintf( '%s / %s', $name, $field['label'] ) );
 
 
73
  }
74
  }
75
  }
@@ -97,7 +99,10 @@ class WOOCCM_Fields_i18n {
97
  }
98
  if ( isset( $field['options'] ) ) {
99
  foreach ( $field['options'] as $option_data ) {
100
- icl_register_string( 'woocommerce-checkout-manager', $option_data['label'], $option_data['label'], false, $icl_language_code );
 
 
 
101
  }
102
  }
103
  }
@@ -111,70 +116,6 @@ class WOOCCM_Fields_i18n {
111
  }
112
  return self::$_instance;
113
  }
114
-
115
- /*
116
- public function register_wpml_string( $value ) {
117
- if ( ! empty( $value ) && function_exists( 'icl_register_string' ) ) {
118
-
119
- if ( is_array( $value ) ) {
120
-
121
- foreach ( $value as $key => $name ) {
122
- icl_register_string( WOOCCM_PLUGIN_NAME, $name, $name );
123
- }
124
-
125
- return $value;
126
- }
127
-
128
- if ( is_string( $value ) ) {
129
- icl_register_string( WOOCCM_PLUGIN_NAME, $value, $value );
130
- return $value;
131
- }
132
- }
133
-
134
- return $value;
135
- }
136
-
137
- public function i18n( $string ) {
138
- if ( function_exists( 'icl_t' ) ) {
139
- return icl_t( WOOCCM_PLUGIN_NAME, $string, $string );
140
- }
141
-
142
- return esc_html__( $string, self::$domain );
143
- }
144
-
145
- public function translate( $value ) {
146
- if ( ! empty( $value ) ) {
147
-
148
- if ( is_array( $value ) ) {
149
- foreach ( $value as $key => $name ) {
150
- if ( is_string( $name ) ) {
151
- $value[ $key ] = $this->i18n( $name );
152
- }
153
- }
154
- }
155
-
156
- if ( is_string( $value ) ) {
157
- $value = $this->i18n( $value );
158
- }
159
- }
160
-
161
- return $value;
162
- }
163
-
164
- public function translate_field( $field ) {
165
- // ii18n
166
- // -----------------------------------------------------------------------
167
-
168
- if ( ! empty( $field['label'] ) ) {
169
- $field['label'] = $this->translate( $field['label'] );
170
- }
171
-
172
- if ( ! empty( $field['placeholder'] ) ) {
173
- $field['placeholder'] = $this->translate( $field['placeholder'] );
174
- }
175
-
176
- return $field;
177
- } */
178
  }
179
 
180
  WOOCCM_Fields_i18n::instance();
67
  pll_register_string( $field['description'], $field['description'], $name );
68
  }
69
 
70
+ if ( isset( $field['options'] ) ) {
71
+ foreach ( $field['options'] as $option_data ) {
72
+ if ( isset( $option_data['label'] ) ) {
73
+ pll_register_string( $option_data['label'], $option_data['label'], sprintf( '%s / %s', $name, $field['label'] ) );
74
+ }
75
  }
76
  }
77
  }
99
  }
100
  if ( isset( $field['options'] ) ) {
101
  foreach ( $field['options'] as $option_data ) {
102
+ if ( isset( $option_data['label'] ) ) {
103
+ // 1326
104
+ icl_register_string( 'woocommerce-checkout-manager', $option_data['label'], $option_data['label'], false, $icl_language_code );
105
+ }
106
  }
107
  }
108
  }
116
  }
117
  return self::$_instance;
118
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
  WOOCCM_Fields_i18n::instance();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: checkout field editor, woocommerce checkout field editor, checkout manager
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
- Stable tag: 6.1.0
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.7
11
  License: GPLv3
@@ -149,6 +149,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
149
 
150
  == Changelog ==
151
 
 
 
 
152
  = 6.1.0
153
  * Fix. WooCommerce Checkout force shipping address
154
  * Fix. WooCommerce Checkout WPML compatbility
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
+ Stable tag: 6.1.1
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.7
11
  License: GPLv3
149
 
150
  == Changelog ==
151
 
152
+ = 6.1.1
153
+ * Fix. PHP erros
154
+
155
  = 6.1.0
156
  * Fix. WooCommerce Checkout force shipping address
157
  * Fix. WooCommerce Checkout WPML compatbility
woocommerce-checkout-manager.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
- * Version: 6.1.0
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -20,7 +20,7 @@ if ( ! defined( 'WOOCCM_PLUGIN_NAME' ) ) {
20
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
21
  }
22
  if ( ! defined( 'WOOCCM_PLUGIN_VERSION' ) ) {
23
- define( 'WOOCCM_PLUGIN_VERSION', '6.1.0' );
24
  }
25
  if ( ! defined( 'WOOCCM_PLUGIN_FILE' ) ) {
26
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
+ * Version: 6.1.1
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
20
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
21
  }
22
  if ( ! defined( 'WOOCCM_PLUGIN_VERSION' ) ) {
23
+ define( 'WOOCCM_PLUGIN_VERSION', '6.1.1' );
24
  }
25
  if ( ! defined( 'WOOCCM_PLUGIN_FILE' ) ) {
26
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );