WooCommerce Checkout Field Editor (Manager) Pro - Version 1.0.9

Version Description

  • Fix for enhanced select pre populate issue in admin settings page.
Download this release

Release Info

Developer ThemeHigh
Plugin Icon 128x128 WooCommerce Checkout Field Editor (Manager) Pro
Version 1.0.9
Comparing to
See all releases

Code changes from version 1.2.0 to 1.0.9

assets/css/thwcfd-style.css CHANGED
@@ -143,8 +143,4 @@ h1.nav-tab-wrapper, h2.nav-tab-wrapper, h3.nav-tab-wrapper {
143
  border-bottom: 1px solid #CCC;
144
  padding-bottom: 0px;
145
  padding-left: 10px;
146
- }
147
-
148
- /*.select2-drop {
149
- z-index: 999999!important;
150
- }*/
143
  border-bottom: 1px solid #CCC;
144
  padding-bottom: 0px;
145
  padding-left: 10px;
146
+ }
 
 
 
 
assets/js/thwcfd-admin.js CHANGED
@@ -79,7 +79,6 @@ var wcfd_settings = (function($, window, document) {
79
  wcfd_clear_form(form);
80
  form.find("input[name=fname]").val(tabName);
81
  form.find("select[name=ftype]").change();
82
- form.find("input[name=fclass]").val('form-row-wide');
83
 
84
  $( "#wcfd_new_field_form_pp" ).dialog( "open" );
85
  }
79
  wcfd_clear_form(form);
80
  form.find("input[name=fname]").val(tabName);
81
  form.find("select[name=ftype]").change();
 
82
 
83
  $( "#wcfd_new_field_form_pp" ).dialog( "open" );
84
  }
checkout-form-designer.php CHANGED
@@ -3,26 +3,16 @@
3
  * Plugin Name: Woo Checkout Field Editor Pro
4
  * Description: Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields).
5
  * Author: ThemeHiGH
6
- * Version: 1.2.0
7
- * Author URI: https://www.themehigh.com
8
- * Plugin URI: https://www.themehigh.com
9
  * Text Domain: thwcfd
10
  * Domain Path: /languages
11
  */
12
 
13
  if(!defined( 'ABSPATH' )) exit;
14
 
15
- if (!function_exists('is_woocommerce_active')){
16
- function is_woocommerce_active(){
17
- $active_plugins = (array) get_option('active_plugins', array());
18
- if(is_multisite()){
19
- $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
20
- }
21
- return in_array('woocommerce/woocommerce.php', $active_plugins) || array_key_exists('woocommerce/woocommerce.php', $active_plugins);
22
- }
23
- }
24
-
25
- if(is_woocommerce_active()) {
26
  load_plugin_textdomain( 'thwcfd', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
27
 
28
  /**
@@ -45,26 +35,6 @@ if(is_woocommerce_active()) {
45
  }
46
  add_action('init', 'thwcfd_init_checkout_field_editor_lite');
47
 
48
- function thwcfd_is_locale_field( $field_name ){
49
- if(!empty($field_name) && in_array($field_name, array(
50
- 'billing_address_1', 'billing_address_2', 'billing_state', 'billing_postcode', 'billing_city',
51
- 'shipping_address_1', 'shipping_address_2', 'shipping_state', 'shipping_postcode', 'shipping_city',
52
- ))){
53
- return true;
54
- }
55
- return false;
56
- }
57
-
58
- function thwcfd_woocommerce_version_check( $version = '3.0' ) {
59
- if(function_exists( 'is_woocommerce_active' ) && is_woocommerce_active() ) {
60
- global $woocommerce;
61
- if( version_compare( $woocommerce->version, $version, ">=" ) ) {
62
- return true;
63
- }
64
- }
65
- return false;
66
- }
67
-
68
  /**
69
  * Hide Additional Fields title if no fields available.
70
  *
@@ -91,66 +61,11 @@ if(is_woocommerce_active()) {
91
  }
92
  add_filter('woocommerce_enable_order_notes_field', 'thwcfd_enable_order_notes_field', 1000);
93
 
94
- function thwcfd_woo_default_address_fields( $original ) {
95
- $sname = apply_filters('thwcfd_address_field_override_with', 'billing');
96
- $address_fields = get_option('wc_fields_'.$sname);
97
-
98
- if(is_array($address_fields) && !empty($address_fields) && !empty($original)){
99
- $override_required = apply_filters( 'thwcfd_address_field_override_required', true );
100
-
101
- foreach($original as $name => $ofield) {
102
- $fname = $sname.'_'.$name;
103
-
104
- if(thwcfd_is_locale_field($fname) && $override_required){
105
- $new_field = isset($address_fields[$fname]) ? $address_fields[$fname] : false;
106
-
107
- if($new_field && !( isset($new_field['enabled']) && $new_field['enabled'] == false )){
108
- $original[$name]['required'] = isset($new_field['required']) && $new_field['required'] ? true : false;
109
- }
110
- }
111
- }
112
- }
113
-
114
- return $original;
115
  }
116
- add_filter('woocommerce_default_address_fields' , 'thwcfd_woo_default_address_fields' );
117
-
118
- function thwcfd_prepare_country_locale($fields) {
119
- if(is_array($fields)){
120
- foreach($fields as $key => $props){
121
- $override_ph = apply_filters( 'thwcfd_address_field_override_placeholder', true );
122
- $override_label = apply_filters( 'thwcfd_address_field_override_label', true );
123
- $override_required = apply_filters( 'thwcfd_address_field_override_required', false );
124
-
125
- if($override_ph && isset($props['placeholder'])){
126
- unset($fields[$key]['placeholder']);
127
- }
128
- if($override_label && isset($props['label'])){
129
- unset($fields[$key]['label']);
130
- }
131
- if($override_required && isset($props['required'])){
132
- unset($fields[$key]['required']);
133
- }
134
-
135
- if(isset($props['priority'])){
136
- unset($fields[$key]['priority']);
137
- }
138
- }
139
- }
140
- return $fields;
141
- }
142
- add_filter('woocommerce_get_country_locale_default', 'thwcfd_prepare_country_locale');
143
- add_filter('woocommerce_get_country_locale_base', 'thwcfd_prepare_country_locale');
144
-
145
- function thwcfd_woo_get_country_locale($locale) {
146
- if(is_array($locale)){
147
- foreach($locale as $country => $fields){
148
- $locale[$country] = thwcfd_prepare_country_locale($fields);
149
- }
150
- }
151
- return $locale;
152
- }
153
- add_filter('woocommerce_get_country_locale', 'thwcfd_woo_get_country_locale');
154
 
155
  /**
156
  * wc_checkout_fields_modify_billing_fields function.
@@ -197,18 +112,30 @@ if(is_woocommerce_active()) {
197
  }
198
 
199
  if($additional_fields = get_option('wc_fields_additional')){
200
- if( isset($fields['order']) && is_array($fields['order']) ){
201
- $fields['order'] = $additional_fields + $fields['order'];
202
- }
203
 
204
  // check if order_comments is enabled/disabled
205
  if(isset($additional_fields) && !$additional_fields['order_comments']['enabled']){
206
  unset($fields['order']['order_comments']);
207
  }
208
  }
209
-
 
 
 
 
 
 
 
210
  if(isset($fields['order']) && is_array($fields['order'])){
211
- $fields['order'] = thwcfd_prepare_checkout_fields_lite($fields['order'], false);
 
 
 
 
 
 
 
212
  }
213
 
214
  return $fields;
@@ -221,121 +148,7 @@ if(is_woocommerce_active()) {
221
  * @param mixed $data
222
  * @param mixed $old
223
  */
224
- function thwcfd_prepare_checkout_fields_lite($fields, $original_fields) {
225
- if(is_array($fields) && !empty($fields)) {
226
- foreach($fields as $name => $field) {
227
- if(isset($field['enabled']) && $field['enabled'] == false ) {
228
- unset($fields[$name]);
229
- }else{
230
- $new_field = false;
231
-
232
- if($original_fields && isset($original_fields[$name])){
233
- $new_field = $original_fields[$name];
234
-
235
- $new_field['label'] = isset($field['label']) ? $field['label'] : '';
236
- $new_field['placeholder'] = isset($field['placeholder']) ? $field['placeholder'] : '';
237
-
238
- $new_field['class'] = isset($field['class']) && is_array($field['class']) ? $field['class'] : array();
239
- $new_field['label_class'] = isset($field['label_class']) && is_array($field['label_class']) ? $field['label_class'] : array();
240
- $new_field['validate'] = isset($field['validate']) && is_array($field['validate']) ? $field['validate'] : array();
241
-
242
- if(!thwcfd_is_locale_field($name)){
243
- $new_field['required'] = isset($field['required']) ? $field['required'] : 0;
244
- }
245
- $new_field['clear'] = isset($field['clear']) ? $field['clear'] : 0;
246
- }else{
247
- $new_field = $field;
248
- }
249
-
250
- $new_field['order'] = isset($field['order']) && is_numeric($field['order']) ? $field['order'] : 0;
251
- if(isset($new_field['order']) && is_numeric($new_field['order'])){
252
- $new_field['priority'] = $new_field['order'];
253
- }
254
-
255
- if(isset($new_field['label'])){
256
- $new_field['label'] = __($new_field['label'], 'woocommerce');
257
- }
258
- if(isset($new_field['placeholder'])){
259
- $new_field['placeholder'] = __($new_field['placeholder'], 'woocommerce');
260
- }
261
-
262
- $fields[$name] = $new_field;
263
- }
264
- }
265
- return $fields;
266
- }else {
267
- return $original_fields;
268
- }
269
- }
270
-
271
- /*****************************************
272
- ----- Display Field Values - START ------
273
- *****************************************/
274
-
275
- /**
276
- * Display custom fields in emails
277
- *
278
- * @param array $keys
279
- * @return array
280
- */
281
- function thwcfd_display_custom_fields_in_emails_lite($keys){
282
- $custom_keys = array();
283
- $fields = array_merge(WC_Checkout_Field_Editor::get_fields('billing'), WC_Checkout_Field_Editor::get_fields('shipping'),
284
- WC_Checkout_Field_Editor::get_fields('additional'));
285
-
286
- // Loop through all custom fields to see if it should be added
287
- foreach( $fields as $name => $options ) {
288
- if(isset($options['show_in_email']) && $options['show_in_email']){
289
- $custom_keys[ esc_attr( $options['label'] ) ] = esc_attr( $name );
290
- }
291
- }
292
-
293
- return array_merge( $keys, $custom_keys );
294
- }
295
- add_filter('woocommerce_email_order_meta_keys', 'thwcfd_display_custom_fields_in_emails_lite', 10, 1);
296
-
297
- /**
298
- * Display custom checkout fields on view order pages
299
- *
300
- * @param object $order
301
- */
302
- function thwcfd_order_details_after_customer_details_lite($order){
303
- if(thwcfd_woocommerce_version_check()){
304
- $order_id = $order->get_id();
305
- }else{
306
- $order_id = $order->id;
307
- }
308
-
309
- $fields = array();
310
- if(!wc_ship_to_billing_address_only() && $order->needs_shipping_address()){
311
- $fields = array_merge(WC_Checkout_Field_Editor::get_fields('billing'), WC_Checkout_Field_Editor::get_fields('shipping'),
312
- WC_Checkout_Field_Editor::get_fields('additional'));
313
- }else{
314
- $fields = array_merge(WC_Checkout_Field_Editor::get_fields('billing'), WC_Checkout_Field_Editor::get_fields('additional'));
315
- }
316
-
317
- // Loop through all custom fields to see if it should be added
318
- foreach($fields as $name => $options){
319
- $enabled = (isset($options['enabled']) && $options['enabled'] == false) ? false : true;
320
- $is_custom_field = (isset($options['custom']) && $options['custom'] == true) ? true : false;
321
-
322
- if(isset($options['show_in_order']) && $options['show_in_order'] && $enabled && $is_custom_field){
323
- $value = get_post_meta($order_id, $name, true);
324
-
325
- if(!empty($value)){
326
- $label = isset($options['label']) && !empty($options['label']) ? __( $options['label'], 'woocommerce' ) : $name;
327
- echo '<tr><th>'. esc_attr($label) .':</th><td>'. wptexturize($value) .'</td></tr>';
328
- }
329
- }
330
- }
331
- }
332
- add_action('woocommerce_order_details_after_customer_details', 'thwcfd_order_details_after_customer_details_lite', 20, 1);
333
-
334
- /*****************************************
335
- ----- Display Field Values - END --------
336
- *****************************************/
337
-
338
- /*function thwcfd_prepare_checkout_fields_lite( $data, $old_fields ) {
339
  global $WC_Checkout_Field_Editor;
340
 
341
  if( empty( $data ) ) {
@@ -375,31 +188,24 @@ if(is_woocommerce_active()) {
375
  }
376
 
377
  if(isset($fields[$name])){
378
- if(isset($fields[$name]['label'])){
379
- $fields[ $name ]['label'] = __($fields[ $name ]['label'], 'woocommerce');
380
- }
381
- if(isset($fields[$name]['placeholder'])){
382
- $fields[ $name ]['placeholder'] = __($fields[ $name ]['placeholder'], 'woocommerce');
383
- }
384
- if(isset($fields[$name]['order'])){
385
- $fields[ $name ]['priority'] = is_numeric($fields[$name]['order']) ? $fields[$name]['order'] : '';
386
- }
387
  }
388
  }
389
  return $fields;
390
  }
391
- }*/
392
 
393
  /**
394
  * wc_checkout_fields_validation function.
395
  *
396
  * @param mixed $posted
397
  */
398
- /*function thwcfd_checkout_fields_validation_lite($posted){
399
  foreach(WC()->checkout->checkout_fields as $fieldset_key => $fieldset){
400
 
401
  // Skip shipping if its not needed
402
- if($fieldset_key === 'shipping' && (wc_ship_to_billing_address_only() || !empty($posted['shiptobilling']) ||
403
  (!WC()->cart->needs_shipping() && get_option('woocommerce_require_shipping_address') === 'no'))){
404
  continue;
405
  }
@@ -429,7 +235,65 @@ if(is_woocommerce_active()) {
429
  }
430
  }
431
  }
432
- }*/
433
- //add_action('woocommerce_after_checkout_validation', 'thwcfd_checkout_fields_validation_lite');
434
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  }
3
  * Plugin Name: Woo Checkout Field Editor Pro
4
  * Description: Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields).
5
  * Author: ThemeHiGH
6
+ * Version: 1.0.9
7
+ * Author URI: http://www.themehigh.com
8
+ * Plugin URI: http://www.themehigh.com
9
  * Text Domain: thwcfd
10
  * Domain Path: /languages
11
  */
12
 
13
  if(!defined( 'ABSPATH' )) exit;
14
 
15
+ if(in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
 
 
 
 
 
 
 
 
 
 
16
  load_plugin_textdomain( 'thwcfd', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
17
 
18
  /**
35
  }
36
  add_action('init', 'thwcfd_init_checkout_field_editor_lite');
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * Hide Additional Fields title if no fields available.
40
  *
61
  }
62
  add_filter('woocommerce_enable_order_notes_field', 'thwcfd_enable_order_notes_field', 1000);
63
 
64
+ /*function thwcfd_woo_default_address_fields( $address_fields ) {
65
+ $address_fields['state']['label'] = 'County';
66
+ return $address_fields;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
+ add_filter( 'woocommerce_default_address_fields' , 'thwcfd_woo_default_address_fields' );*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  /**
71
  * wc_checkout_fields_modify_billing_fields function.
112
  }
113
 
114
  if($additional_fields = get_option('wc_fields_additional')){
115
+ $fields['order'] = $additional_fields + $fields['order'];
 
 
116
 
117
  // check if order_comments is enabled/disabled
118
  if(isset($additional_fields) && !$additional_fields['order_comments']['enabled']){
119
  unset($fields['order']['order_comments']);
120
  }
121
  }
122
+
123
+ if(isset($fields['account']) && is_array($fields['account'])){
124
+ foreach( $fields['account'] as $name => $values ) {
125
+ $fields['account'][ $name ]['label'] = __($fields['account'][ $name ]['label'], 'woocommerce');
126
+ $fields['account'][ $name ]['placeholder'] = __($fields['account'][ $name ]['placeholder'], 'woocommerce');
127
+ }
128
+ }
129
+
130
  if(isset($fields['order']) && is_array($fields['order'])){
131
+ foreach( $fields['order'] as $name => $values ) {
132
+ if (isset($values['enabled']) && $values['enabled'] == false ) {
133
+ unset( $fields['order'][ $name ] );
134
+ }else{
135
+ $fields['order'][ $name ]['label'] = __($fields['order'][ $name ]['label'], 'woocommerce');
136
+ $fields['order'][ $name ]['placeholder'] = __($fields['order'][ $name ]['placeholder'], 'woocommerce');
137
+ }
138
+ }
139
  }
140
 
141
  return $fields;
148
  * @param mixed $data
149
  * @param mixed $old
150
  */
151
+ function thwcfd_prepare_checkout_fields_lite( $data, $old_fields ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  global $WC_Checkout_Field_Editor;
153
 
154
  if( empty( $data ) ) {
188
  }
189
 
190
  if(isset($fields[$name])){
191
+ $fields[ $name ]['label'] = __($fields[ $name ]['label'], 'woocommerce');
192
+ $fields[ $name ]['placeholder'] = __($fields[ $name ]['placeholder'], 'woocommerce');
 
 
 
 
 
 
 
193
  }
194
  }
195
  return $fields;
196
  }
197
+ }
198
 
199
  /**
200
  * wc_checkout_fields_validation function.
201
  *
202
  * @param mixed $posted
203
  */
204
+ function thwcfd_checkout_fields_validation_lite($posted){
205
  foreach(WC()->checkout->checkout_fields as $fieldset_key => $fieldset){
206
 
207
  // Skip shipping if its not needed
208
+ if($fieldset_key === 'shipping' && (WC()->cart->ship_to_billing_address_only() || !empty($posted['shiptobilling']) ||
209
  (!WC()->cart->needs_shipping() && get_option('woocommerce_require_shipping_address') === 'no'))){
210
  continue;
211
  }
235
  }
236
  }
237
  }
238
+ }
239
+ add_action('woocommerce_after_checkout_validation', 'thwcfd_checkout_fields_validation_lite');
240
 
241
+ /**
242
+ * Display custom fields in emails
243
+ *
244
+ * @param array $keys
245
+ * @return array
246
+ */
247
+ function thwcfd_display_custom_fields_in_emails_lite($keys){
248
+ $custom_keys = array();
249
+ $fields = array_merge(WC_Checkout_Field_Editor::get_fields('billing'), WC_Checkout_Field_Editor::get_fields('shipping'),
250
+ WC_Checkout_Field_Editor::get_fields('additional'));
251
+
252
+ // Loop through all custom fields to see if it should be added
253
+ foreach( $fields as $name => $options ) {
254
+ if(isset($options['show_in_email']) && $options['show_in_email']){
255
+ $custom_keys[ esc_attr( $options['label'] ) ] = esc_attr( $name );
256
+ }
257
+ }
258
+
259
+ return array_merge( $keys, $custom_keys );
260
+ }
261
+ add_filter('woocommerce_email_order_meta_keys', 'thwcfd_display_custom_fields_in_emails_lite', 10, 1);
262
+
263
+ /**
264
+ * Display custom checkout fields on view order pages
265
+ *
266
+ * @param object $order
267
+ */
268
+ function thwcfd_order_details_after_customer_details_lite($order){
269
+ $order_id = $order->id;
270
+
271
+ $fields = array();
272
+ if(!wc_ship_to_billing_address_only() && $order->needs_shipping_address()){
273
+ $fields = array_merge(WC_Checkout_Field_Editor::get_fields('billing'), WC_Checkout_Field_Editor::get_fields('shipping'),
274
+ WC_Checkout_Field_Editor::get_fields('additional'));
275
+ }else{
276
+ $fields = array_merge(WC_Checkout_Field_Editor::get_fields('billing'), WC_Checkout_Field_Editor::get_fields('additional'));
277
+ }
278
+
279
+ $found = false;
280
+ $html = '';
281
+
282
+ // Loop through all custom fields to see if it should be added
283
+ foreach($fields as $name => $options){
284
+ $enabled = (isset($options['enabled']) && $options['enabled'] == false) ? false : true;
285
+ $is_custom_field = (isset($options['custom']) && $options['custom'] == true) ? true : false;
286
+
287
+ if(isset($options['show_in_order']) && $options['show_in_order'] && $enabled && $is_custom_field){
288
+ $found = true;
289
+ $html .= '<dt>' . esc_attr( $options['label'] ) . ':</dt>';
290
+ $html .= '<dd>' . get_post_meta( $order_id, $name, true ) . '</dd>';
291
+ }
292
+ }
293
+ if($found){
294
+ echo '<dl>'. $html .'</dl>';
295
+ }
296
+ }
297
+ add_action('woocommerce_order_details_after_customer_details', 'thwcfd_order_details_after_customer_details_lite', 20, 1);
298
+
299
  }
classes/class-wc-checkout-field-editor-export-handler.php CHANGED
@@ -8,8 +8,8 @@ class WC_Checkout_Field_Editor_Export_Handler {
8
  $this->fields = $this->get_fields();
9
 
10
  // Customer / Order CSV Export column headers/data
11
- //add_filter( 'wc_customer_order_csv_export_order_headers', array( $this, 'thwcfd_order_csv_export_order_headers' ), 10, 2 );
12
- //add_filter( 'wc_customer_order_csv_export_order_row', array( $this, 'thwcfd_customer_order_csv_export_order_row' ), 10, 4 );
13
  }
14
 
15
  /**
8
  $this->fields = $this->get_fields();
9
 
10
  // Customer / Order CSV Export column headers/data
11
+ add_filter( 'wc_customer_order_csv_export_order_headers', array( $this, 'thwcfd_order_csv_export_order_headers' ), 10, 2 );
12
+ add_filter( 'wc_customer_order_csv_export_order_row', array( $this, 'thwcfd_customer_order_csv_export_order_row' ), 10, 4 );
13
  }
14
 
15
  /**
classes/class-wc-checkout-field-editor.php CHANGED
@@ -51,13 +51,11 @@ class WC_Checkout_Field_Editor {
51
  <p><strong><i>WooCommerce Checkout Field Editor Pro</i></strong> premium version provides more features to design your checkout page.</p>
52
  <ul>
53
  <li>12 field types available,<br/>(<i>Text, Hidden, Password, Textarea, Radio, Checkbox, Select, Multi-select, Date Picker, Time Picker, Heading, Label</i>).</li>
54
- <li>Conditionally display fields based on cart items and other field(s) values.</li>
55
- <li>Add an extra cost to the cart total based on field selection.</li>
56
  <li>Option to add more sections in addition to the core sections (billing, shipping and additional) in checkout page.</li>
57
  </ul>
58
  </td>
59
  <td>
60
- <a target="_blank" href="https://www.themehigh.com/product/woocommerce-checkout-field-editor-pro/" class="">
61
  <img src="<?php echo plugins_url( '../assets/css/upgrade-btn.png', __FILE__ ); ?>" />
62
  </a>
63
  </td>
@@ -122,7 +120,7 @@ class WC_Checkout_Field_Editor {
122
  $fields = $this->get_fields($type);
123
 
124
  foreach($fields as $name => $field){
125
- if(isset($field['custom']) && $field['custom'] && isset($posted[$name])){
126
  $value = wc_clean($posted[$name]);
127
  if($value){
128
  update_post_meta($order_id, $name, $value);
@@ -209,10 +207,10 @@ class WC_Checkout_Field_Editor {
209
  <td>Class</td>
210
  <td><input type="text" name="fclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
211
  </tr>
212
- <!--<tr class="rowLabelClass">
213
  <td>Label Class</td>
214
  <td><input type="text" name="flabelclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
215
- </tr>-->
216
  <tr class="rowValidate">
217
  <td>Validation</td>
218
  <td>
@@ -302,10 +300,10 @@ class WC_Checkout_Field_Editor {
302
  <td>Class</td>
303
  <td><input type="text" name="fclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
304
  </tr>
305
- <!--<tr class="rowLabelClass">
306
  <td>Label Class</td>
307
  <td><input type="text" name="flabelclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
308
- </tr>-->
309
  <tr class="rowValidate">
310
  <td>Validation</td>
311
  <td>
@@ -479,31 +477,31 @@ class WC_Checkout_Field_Editor {
479
  $options['placeholder'] = '';
480
  }
481
 
482
- if( isset( $options['options'] ) && is_array($options['options']) ) {
483
  $options['options'] = implode("|", $options['options']);
484
  }else{
485
  $options['options'] = '';
486
  }
487
 
488
- if( isset( $options['class'] ) && is_array($options['class']) ) {
489
  $options['class'] = implode(",", $options['class']);
490
  }else{
491
  $options['class'] = '';
492
  }
493
 
494
- if( isset( $options['label_class'] ) && is_array($options['label_class']) ) {
495
  $options['label_class'] = implode(",", $options['label_class']);
496
  }else{
497
  $options['label_class'] = '';
498
  }
499
 
500
- if( isset( $options['validate'] ) && is_array($options['validate']) ) {
501
  $options['validate'] = implode(",", $options['validate']);
502
  }else{
503
  $options['validate'] = '';
504
  }
505
 
506
- if ( isset( $options['required'] ) && $options['required'] == 1 ) {
507
  $options['required'] = '1';
508
  } else {
509
  $options['required'] = '0';
@@ -666,7 +664,7 @@ class WC_Checkout_Field_Editor {
666
  $fields[$name]['type'] = empty( $f_types[$i] ) ? $o_type : wc_clean( $f_types[$i] );
667
  $fields[$name]['label'] = empty( $f_labels[$i] ) ? '' : wp_kses_post( trim( stripslashes( $f_labels[$i] ) ) );
668
  $fields[$name]['placeholder'] = empty( $f_placeholder[$i] ) ? '' : wc_clean( stripslashes( $f_placeholder[$i] ) );
669
- $fields[$name]['options'] = empty( $f_options[$i] ) ? array() : array_map( 'wc_clean', explode( '|', trim(stripslashes($f_options[$i])) ) );
670
 
671
  $fields[$name]['class'] = empty( $f_class[$i] ) ? array() : array_map( 'wc_clean', explode( ',', $f_class[$i] ) );
672
  $fields[$name]['label_class'] = empty( $f_label_class[$i] ) ? array() : array_map( 'wc_clean', explode( ',', $f_label_class[$i] ) );
@@ -706,5 +704,45 @@ class WC_Checkout_Field_Editor {
706
  echo '<div class="error"><p> ' . __( 'Your changes were not saved due to an error (or you made none!).', 'thwcfd' ) . '</p></div>';
707
  }
708
  }
709
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
710
  }
51
  <p><strong><i>WooCommerce Checkout Field Editor Pro</i></strong> premium version provides more features to design your checkout page.</p>
52
  <ul>
53
  <li>12 field types available,<br/>(<i>Text, Hidden, Password, Textarea, Radio, Checkbox, Select, Multi-select, Date Picker, Time Picker, Heading, Label</i>).</li>
 
 
54
  <li>Option to add more sections in addition to the core sections (billing, shipping and additional) in checkout page.</li>
55
  </ul>
56
  </td>
57
  <td>
58
+ <a target="_blank" href="http://themehigh.com" class="">
59
  <img src="<?php echo plugins_url( '../assets/css/upgrade-btn.png', __FILE__ ); ?>" />
60
  </a>
61
  </td>
120
  $fields = $this->get_fields($type);
121
 
122
  foreach($fields as $name => $field){
123
+ if(!empty($field['custom'])){
124
  $value = wc_clean($posted[$name]);
125
  if($value){
126
  update_post_meta($order_id, $name, $value);
207
  <td>Class</td>
208
  <td><input type="text" name="fclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
209
  </tr>
210
+ <tr class="rowLabelClass">
211
  <td>Label Class</td>
212
  <td><input type="text" name="flabelclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
213
+ </tr>
214
  <tr class="rowValidate">
215
  <td>Validation</td>
216
  <td>
300
  <td>Class</td>
301
  <td><input type="text" name="fclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
302
  </tr>
303
+ <tr class="rowLabelClass">
304
  <td>Label Class</td>
305
  <td><input type="text" name="flabelclass" placeholder="Seperate classes with comma" style="width:250px;"/></td>
306
+ </tr>
307
  <tr class="rowValidate">
308
  <td>Validation</td>
309
  <td>
477
  $options['placeholder'] = '';
478
  }
479
 
480
+ if( isset( $options['options'] ) ) {
481
  $options['options'] = implode("|", $options['options']);
482
  }else{
483
  $options['options'] = '';
484
  }
485
 
486
+ if( isset( $options['class'] ) ) {
487
  $options['class'] = implode(",", $options['class']);
488
  }else{
489
  $options['class'] = '';
490
  }
491
 
492
+ if( isset( $options['label_class'] ) ) {
493
  $options['label_class'] = implode(",", $options['label_class']);
494
  }else{
495
  $options['label_class'] = '';
496
  }
497
 
498
+ if( isset( $options['validate'] ) ) {
499
  $options['validate'] = implode(",", $options['validate']);
500
  }else{
501
  $options['validate'] = '';
502
  }
503
 
504
+ if ( !isset( $options['required'] ) || $options['required'] == 1 ) {
505
  $options['required'] = '1';
506
  } else {
507
  $options['required'] = '0';
664
  $fields[$name]['type'] = empty( $f_types[$i] ) ? $o_type : wc_clean( $f_types[$i] );
665
  $fields[$name]['label'] = empty( $f_labels[$i] ) ? '' : wp_kses_post( trim( stripslashes( $f_labels[$i] ) ) );
666
  $fields[$name]['placeholder'] = empty( $f_placeholder[$i] ) ? '' : wc_clean( stripslashes( $f_placeholder[$i] ) );
667
+ $fields[$name]['options'] = empty( $f_options[$i] ) ? array() : array_map( 'wc_clean', explode( '|', $f_options[$i] ) );
668
 
669
  $fields[$name]['class'] = empty( $f_class[$i] ) ? array() : array_map( 'wc_clean', explode( ',', $f_class[$i] ) );
670
  $fields[$name]['label_class'] = empty( $f_label_class[$i] ) ? array() : array_map( 'wc_clean', explode( ',', $f_label_class[$i] ) );
704
  echo '<div class="error"><p> ' . __( 'Your changes were not saved due to an error (or you made none!).', 'thwcfd' ) . '</p></div>';
705
  }
706
  }
707
+
708
+ /*
709
+ function get_woocommerce_checkout_fields(){
710
+ $billing = array(
711
+ 'billing_first_name',
712
+ 'billing_last_name',
713
+ 'billing_company',
714
+ 'billing_address_1',
715
+ 'billing_address_2',
716
+ 'billing_city',
717
+ 'billing_postcode',
718
+ 'billing_country',
719
+ 'billing_state',
720
+ 'billing_email',
721
+ 'billing_phone'
722
+ );
723
+ $shipping = array(
724
+ 'shipping_first_name',
725
+ 'shipping_last_name',
726
+ 'shipping_company',
727
+ 'shipping_address_1',
728
+ 'shipping_address_2',
729
+ 'shipping_city',
730
+ 'shipping_postcode',
731
+ 'shipping_country',
732
+ 'shipping_state',
733
+ );
734
+ $account = array(
735
+ 'account_username',
736
+ 'account_password',
737
+ 'account_password-2',
738
+ );
739
+ $order = array(
740
+ 'order_comments',
741
+ );
742
+ }
743
+
744
+ function get_properties(){
745
+ $properties = array('type', 'label', 'placeholder', 'class', 'required', 'clear', 'label_class', 'options');
746
+ }
747
+ */
748
  }
readme.txt CHANGED
@@ -1,42 +1,40 @@
1
- === WooCommerce Checkout Field Editor (Manager) Pro ===
2
  Contributors: ThemeHigh
3
- Donate link: https://themehigh.com/
4
- Tags: checkout field editor, woocommerce checkout field editor, checkout manager, woocommerce checkout manager, checkout field customizer, checkout form editor, checkout form customizer, checkout, WooCommerce checkout, checkout form designer, checkout
5
  Requires at least: 3.0.1
6
- Tested up to: 4.8
7
- Stable tag: 1.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- WooCommerce Checkout Field Editor Pro - The best WooCommerce checkout manager plugin to customize checkout fields on your WooCommerce checkout page.
12
 
13
  == Description ==
14
 
15
  = Introduction =
16
- If you are wondering how to add custom field in WooCommerce checkout page, you are at the right place. Woo Checkout Field Editor Pro plugin provides an easy way to customise (add, edit, delete and change display order) your fields displayed on WooCommerce checkout page. This plugin requires WooCommerce to be installed, activated, and configured.
17
 
18
  = BASIC FEATURES =
19
- * <strong>Add new custom field(s).</strong> Adding custom fields to the WooCommerce checkout page is a breeze now. You can add custom field(s) in Billing, Shipping and Additional fields sections. New field form contains options to provide values for Type, Name, Label, Placeholder, Class, Label Class etc. It also has the option to choose validations rules from a predefined list.
20
  * <strong>Edit field(s).</strong> You can edit core and custom field(s) in Billing, Shipping and Additional fields sections. In edit form you have the option to provide new values for Name, Type, Label, Placeholder, Class, Label Class, validation rules etc(availability of these options may change based on the field types).
21
  * Available field types are <strong>Input Text</strong> and <strong>Select</strong>
22
  * <strong>Display in Order Details page and Email.</strong> You can decide on a field whether it need to be displayed in Order Details page and Email using the the checkboxes ‘Display in Order Detail Pages’ and ‘Display in Emails’. These checkboxes are availabe in both the ‘New Field’ and ‘Edit Field’ forms.
23
  * <strong>Remove field(s).</strong> You can remove field(s) from displaying in checkout page, order details page and emails. Removing core fields may leads to unexpected results with some plugins. We are not recommending this.
24
  * <strong>Enable/Disable field(s).</strong> You can enable/disable field(s)(temporarily remove) from displaying in checkout page, order details page and emails. Disabling core fields may leads to unexpected results with some plugins. We are not recommending this.
25
- * <strong>Change checkout fields order.</strong> You can easily manage the display order of checkout fields from admin side by just moving fields up and down.
26
  * <strong>Reset to default field set.</strong> You can reset all your changes back to the original WooCommerce fields set using the button ‘Reset to default fields’.
27
 
28
  = BUY PREMIUM VERSION =
29
- Check out the premium version of WooCommerce Checkout Field Editor Pro - The best WooCommerce checkout manager plugin which helps you to customize checkout fields displayed on your WooCommerce checkout page. Add custom fields to WooCommerce checkout page easily.
30
- <a rel="nofollow" href="https://www.themehigh.com/product/woocommerce-checkout-field-editor-pro/?utm_source=wordpress&utm_medium=referral&utm_content=tracking">Buy Now!</a>
31
 
32
  <blockquote>
33
  = PREMIUM VERSION FEATURES =
34
  <ul>
35
- <li><strong>12 field types are available:</strong> In Add New Field form and Edit Field form you can choose field type from a list of 12 including 10 input fields and one field for title/heading and one for label.
36
  <p>Available field types:</p>
37
  <ol>
38
  <li><strong>Text</strong> – A basic input text field.</li>
39
- <li><strong>Hidden</strong> – A hidden field.</li>
40
  <li><strong>Password</strong> – An input password text box.</li>
41
  <li><strong>Textarea</strong> – A textarea field.</li>
42
  <li><strong>Radio</strong> – Radio button input (for selecting one of many choices)</li>
@@ -44,13 +42,9 @@ Check out the premium version of WooCommerce Checkout Field Editor Pro - The bes
44
  <li><strong>Select</strong> – A drop-down list (for selecting one of many choices)</li>
45
  <li><strong>Multi-select</strong> – A drop-down list (allows multiple selections from many choices)</li>
46
  <li><strong>Date picker</strong> – Select a date from a popup.</li>
47
- <li><strong>Time picker</strong> – Select a time from a popup.</li>
48
  <li><strong>Heading</strong> – Display a heading/ title</li>
49
- <li><strong>Label</strong> – Display a label/ text</li>
50
  </ol>
51
  </li>
52
- <li><strong>Conditional Fields:</strong> Conditionally display fields based on cart items and other field(s) values.</li>
53
- <li><strong>Price Fields:</strong> Add an extra cost to the cart total based on field selection.</li>
54
  <li><strong>Add new section:</strong> Add new section(s) in predefined positions in checkout page.
55
  <p>Available positions:</p>
56
  <ol>
@@ -102,37 +96,6 @@ Yes. There is a button 'reset to default fields' to go back to the WooCommerce d
102
  8. Newly added field
103
 
104
  == Changelog ==
105
- = 1.2.0 =
106
- * Fix for required validation issue with default address fields.
107
-
108
- = 1.1.9 =
109
- * Fix for required validation issue with default address fields.
110
-
111
- = 1.1.8 =
112
- * Fix for the issue of showing wrong value for placeholder text.
113
-
114
- = 1.1.7 =
115
- * Fix for checkout fields sorting(display order) issue.
116
-
117
- = 1.1.6 =
118
- * Multisite support added
119
- * Removed deprecated function call.
120
-
121
- = 1.1.5 =
122
- * Updated plugin to make it compatible with WooCommerce version 3.0.0
123
-
124
- = 1.1.4 =
125
- * Fix for unsupported operand types issue.
126
-
127
- = 1.1.3 =
128
- * Fix for Address Fields property modification issues.
129
-
130
- = 1.1.2 =
131
- * Fix for 'Invalid argument passed' warning message.
132
-
133
- = 1.1.1 =
134
- * Fix for 'Undefined index' warning/error message.
135
-
136
  = 1.0.9 =
137
  * Fix for enhanced select pre populate issue in admin settings page.
138
 
1
+ === Woo Checkout Field Editor Pro ===
2
  Contributors: ThemeHigh
3
+ Donate link: http://themehigh.com/
4
+ Tags: checkout field editor, checkout field customizer, checkout form editor, checkout form customizer, checkout, WooCommerce checkout, checkout form designer, checkout
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.4
7
+ Stable tag: 1.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ This plugin helps you to customize checkout fields displayed on your WooCommerce checkout page.
12
 
13
  == Description ==
14
 
15
  = Introduction =
16
+ Woo Checkout Field Editor Pro plugin provides an easy way to customise (add, edit, delete and change display order) your fields displayed on WooCommerce checkout page. This plugin requires WooCommerce to be installed, activated, and configured.
17
 
18
  = BASIC FEATURES =
19
+ * <strong>Add new custom field(s).</strong> You can add custom field(s) in Billing, Shipping and Additional fields sections. New field form contains options to provide values for Type, Name, Label, Placeholder, Class, Label Class etc. It also has the option to choose validations rules from a predefined list.
20
  * <strong>Edit field(s).</strong> You can edit core and custom field(s) in Billing, Shipping and Additional fields sections. In edit form you have the option to provide new values for Name, Type, Label, Placeholder, Class, Label Class, validation rules etc(availability of these options may change based on the field types).
21
  * Available field types are <strong>Input Text</strong> and <strong>Select</strong>
22
  * <strong>Display in Order Details page and Email.</strong> You can decide on a field whether it need to be displayed in Order Details page and Email using the the checkboxes ‘Display in Order Detail Pages’ and ‘Display in Emails’. These checkboxes are availabe in both the ‘New Field’ and ‘Edit Field’ forms.
23
  * <strong>Remove field(s).</strong> You can remove field(s) from displaying in checkout page, order details page and emails. Removing core fields may leads to unexpected results with some plugins. We are not recommending this.
24
  * <strong>Enable/Disable field(s).</strong> You can enable/disable field(s)(temporarily remove) from displaying in checkout page, order details page and emails. Disabling core fields may leads to unexpected results with some plugins. We are not recommending this.
25
+ * <strong>Change display field order.</strong> You can easily manage the display order of checkout fields from admin side by just moving fields up and down.
26
  * <strong>Reset to default field set.</strong> You can reset all your changes back to the original WooCommerce fields set using the button ‘Reset to default fields’.
27
 
28
  = BUY PREMIUM VERSION =
29
+ <a rel="nofollow" href="http://themehigh.com/?utm_source=wordpress&utm_medium=referral&utm_content=tracking">Buy Now!</a>
 
30
 
31
  <blockquote>
32
  = PREMIUM VERSION FEATURES =
33
  <ul>
34
+ <li><strong>9 field types are available:</strong> In Add New Field form and Edit Field form you can choose field type from a list of 9 including 8 input fields and one field for title/heading.
35
  <p>Available field types:</p>
36
  <ol>
37
  <li><strong>Text</strong> – A basic input text field.</li>
 
38
  <li><strong>Password</strong> – An input password text box.</li>
39
  <li><strong>Textarea</strong> – A textarea field.</li>
40
  <li><strong>Radio</strong> – Radio button input (for selecting one of many choices)</li>
42
  <li><strong>Select</strong> – A drop-down list (for selecting one of many choices)</li>
43
  <li><strong>Multi-select</strong> – A drop-down list (allows multiple selections from many choices)</li>
44
  <li><strong>Date picker</strong> – Select a date from a popup.</li>
 
45
  <li><strong>Heading</strong> – Display a heading/ title</li>
 
46
  </ol>
47
  </li>
 
 
48
  <li><strong>Add new section:</strong> Add new section(s) in predefined positions in checkout page.
49
  <p>Available positions:</p>
50
  <ol>
96
  8. Newly added field
97
 
98
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  = 1.0.9 =
100
  * Fix for enhanced select pre populate issue in admin settings page.
101