WooCommerce Checkout Field Editor (Manager) Pro - Version 1.3.3

Version Description

  • Displaying customer fields in "Order details" section in admin order detail page.
  • Language file(pot) added.
Download this release

Release Info

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

Code changes from version 1.3.2 to 1.3.3

checkout-form-designer.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Checkout Field Editor for WooCommerce
4
  * Description: Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields).
5
  * Author: ThemeHiGH
6
- * Version: 1.3.2
7
  * Author URI: https://www.themehigh.com
8
  * Plugin URI: https://www.themehigh.com
9
- * Text Domain: thwcfd
10
  * Domain Path: /languages
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 3.6.4
13
  */
14
 
15
  if(!defined( 'ABSPATH' )) exit;
@@ -25,7 +25,12 @@ if (!function_exists('is_woocommerce_active')){
25
  }
26
 
27
  if(is_woocommerce_active()) {
28
- load_plugin_textdomain( 'thwcfd', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
 
 
 
 
29
 
30
  /**
31
  * woocommerce_init_checkout_field_editor function.
@@ -39,6 +44,8 @@ if(is_woocommerce_active()) {
39
  !defined('TH_WCFD_URL') && define('TH_WCFD_URL', plugins_url( '/', __FILE__ ));
40
  !defined('TH_WCFD_ASSETS_URL') && define('TH_WCFD_ASSETS_URL', TH_WCFD_URL . 'assets/');
41
 
 
 
42
  if(!class_exists('WC_Checkout_Field_Editor')){
43
  require_once('classes/class-wc-checkout-field-editor.php');
44
  }
@@ -414,7 +421,7 @@ if(is_woocommerce_active()) {
414
  $value = get_post_meta($order_id, $name, true);
415
 
416
  if(!empty($value)){
417
- $label = isset($options['label']) && !empty($options['label']) ? __( $options['label'], 'woocommerce' ) : $name;
418
 
419
  if(is_account_page()){
420
  if(apply_filters( 'thwcfd_view_order_customer_details_table_view', true )){
3
  * Plugin Name: Checkout Field Editor for WooCommerce
4
  * Description: Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields).
5
  * Author: ThemeHiGH
6
+ * Version: 1.3.3
7
  * Author URI: https://www.themehigh.com
8
  * Plugin URI: https://www.themehigh.com
9
+ * Text Domain: woo-checkout-field-editor-pro
10
  * Domain Path: /languages
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 3.6.5
13
  */
14
 
15
  if(!defined( 'ABSPATH' )) exit;
25
  }
26
 
27
  if(is_woocommerce_active()) {
28
+ function thwcfd_load_plugin_textdomain(){
29
+ $locale = apply_filters('plugin_locale', get_locale(), 'woo-checkout-field-editor-pro');
30
+
31
+ load_textdomain('woo-checkout-field-editor-pro', WP_LANG_DIR.'/woo-checkout-field-editor-pro/woo-checkout-field-editor-pro-'.$locale.'.mo');
32
+ load_plugin_textdomain('woo-checkout-field-editor-pro', false, dirname(TH_WCFD_BASE_NAME) . '/languages/');
33
+ }
34
 
35
  /**
36
  * woocommerce_init_checkout_field_editor function.
44
  !defined('TH_WCFD_URL') && define('TH_WCFD_URL', plugins_url( '/', __FILE__ ));
45
  !defined('TH_WCFD_ASSETS_URL') && define('TH_WCFD_ASSETS_URL', TH_WCFD_URL . 'assets/');
46
 
47
+ thwcfd_load_plugin_textdomain();
48
+
49
  if(!class_exists('WC_Checkout_Field_Editor')){
50
  require_once('classes/class-wc-checkout-field-editor.php');
51
  }
421
  $value = get_post_meta($order_id, $name, true);
422
 
423
  if(!empty($value)){
424
+ $label = isset($options['label']) && !empty($options['label']) ? __( $options['label'], 'woo-checkout-field-editor-pro' ) : $name;
425
 
426
  if(is_account_page()){
427
  if(apply_filters( 'thwcfd_view_order_customer_details_table_view', true )){
classes/class-wc-checkout-field-editor.php CHANGED
@@ -20,6 +20,12 @@ class WC_Checkout_Field_Editor {
20
  add_action('admin_menu', array($this, 'admin_menu'));
21
  add_filter('woocommerce_screen_ids', array($this, 'add_screen_id'));
22
  add_filter('plugin_action_links_'.TH_WCFD_BASE_NAME, array($this, 'add_settings_link'));
 
 
 
 
 
 
23
  add_action('woocommerce_checkout_update_order_meta', array($this, 'save_data'), 10, 2);
24
  }
25
 
@@ -27,7 +33,7 @@ class WC_Checkout_Field_Editor {
27
  * menu function.
28
  */
29
  public function admin_menu() {
30
- $this->screen_id = add_submenu_page('woocommerce', __('WooCommerce Checkout Form Designer', 'thwcfd'), __('Checkout Form', 'thwcfd'),
31
  'manage_woocommerce', 'checkout_form_designer', array($this, 'the_designer'));
32
 
33
  add_action('admin_print_scripts-'. $this->screen_id, array($this, 'enqueue_admin_scripts'));
@@ -38,13 +44,13 @@ class WC_Checkout_Field_Editor {
38
  */
39
  public function add_screen_id($ids){
40
  $ids[] = 'woocommerce_page_checkout_form_designer';
41
- $ids[] = strtolower(__('WooCommerce', 'thwcfd')) .'_page_checkout_form_designer';
42
 
43
  return $ids;
44
  }
45
 
46
  public function add_settings_link($links) {
47
- $settings_link = '<a href="'.admin_url('admin.php?page=checkout_form_designer').'">'. __('Settings') .'</a>';
48
  array_unshift($links, $settings_link);
49
  return $links;
50
  }
@@ -93,7 +99,7 @@ class WC_Checkout_Field_Editor {
93
  delete_option('wc_fields_billing');
94
  delete_option('wc_fields_shipping');
95
  delete_option('wc_fields_additional');
96
- echo '<div class="updated"><p>'. __('SUCCESS: Checkout fields successfully reset', 'thwcfd') .'</p></div>';
97
  }
98
 
99
  public function is_reserved_field_name( $field_name ){
@@ -119,6 +125,72 @@ class WC_Checkout_Field_Editor {
119
  }
120
  return false;
121
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  /**
124
  * Save Data function.
@@ -387,7 +459,7 @@ class WC_Checkout_Field_Editor {
387
  $active = ( $key == $section ) ? 'current' : '';
388
  $url = 'admin.php?page=checkout_form_designer&tab=fields&section='.$key;
389
  echo '<li>';
390
- echo '<a href="'.admin_url($url).'" class="'.$active.'" >'.ucwords($key).' '.__('Fields', 'thwcfd').'</a>';
391
  echo ($size > $i) ? ' | ' : '';
392
  echo '</li>';
393
  }
@@ -428,14 +500,14 @@ class WC_Checkout_Field_Editor {
428
  public function render_actions_row($section){
429
  ?>
430
  <th colspan="6">
431
- <button type="button" class="button button-primary" onclick="openNewFieldForm('<?php echo $section; ?>')"><?php _e( '+ Add field', 'thwcfd' ); ?></button>
432
- <button type="button" class="button" onclick="removeSelectedFields()"><?php _e( 'Remove', 'thwcfd' ); ?></button>
433
- <button type="button" class="button" onclick="enableSelectedFields()"><?php _e( 'Enable', 'thwcfd' ); ?></button>
434
- <button type="button" class="button" onclick="disableSelectedFields()"><?php _e( 'Disable', 'thwcfd' ); ?></button>
435
  </th>
436
  <th colspan="4">
437
- <input type="submit" name="save_fields" class="button-primary" value="<?php _e( 'Save changes', 'thwcfd' ) ?>" style="float:right" />
438
- <input type="submit" name="reset_fields" class="button" value="<?php _e( 'Reset to default fields', 'thwcfd' ) ?>" style="float:right; margin-right: 5px;"
439
  onclick="return confirm('Are you sure you want to reset to default fields? all your changes will be deleted.');"/>
440
  </th>
441
  <?php
@@ -586,7 +658,7 @@ class WC_Checkout_Field_Editor {
586
  <td class="td_enabled status"><?php echo($options['enabled'] == 1 ? '<span class="dashicons dashicons-yes tips" data-tip="Yes"></span>' : '-' ) ?></td>
587
  <td class="td_edit">
588
  <button type="button" class="f_edit_btn" <?php echo($options['enabled'] == 1 ? '' : 'disabled') ?>
589
- onclick="openEditFieldForm(this,<?php echo $i; ?>)"><?php _e( 'Edit', 'thwcfd' ); ?></button>
590
  </td>
591
  </tr>
592
  <?php $i++; endforeach; ?>
@@ -714,9 +786,9 @@ class WC_Checkout_Field_Editor {
714
  $result = update_option( 'wc_fields_' . $section, $fields );
715
 
716
  if ( $result == true ) {
717
- echo '<div class="updated"><p>' . __( 'Your changes were saved.', 'thwcfd' ) . '</p></div>';
718
  } else {
719
- echo '<div class="error"><p> ' . __( 'Your changes were not saved due to an error (or you made none!).', 'thwcfd' ) . '</p></div>';
720
  }
721
  }
722
 
20
  add_action('admin_menu', array($this, 'admin_menu'));
21
  add_filter('woocommerce_screen_ids', array($this, 'add_screen_id'));
22
  add_filter('plugin_action_links_'.TH_WCFD_BASE_NAME, array($this, 'add_settings_link'));
23
+
24
+ // Show in order details page
25
+ add_action('woocommerce_admin_order_data_after_order_details', array($this, 'order_data_after_order_details'), 20, 1);
26
+ add_action('woocommerce_admin_order_data_after_billing_address', array($this, 'order_data_after_billing_address'), 20, 1);
27
+ add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'order_data_after_shipping_address'), 20, 1);
28
+
29
  add_action('woocommerce_checkout_update_order_meta', array($this, 'save_data'), 10, 2);
30
  }
31
 
33
  * menu function.
34
  */
35
  public function admin_menu() {
36
+ $this->screen_id = add_submenu_page('woocommerce', __('WooCommerce Checkout Form Designer', 'woo-checkout-field-editor-pro'), __('Checkout Form', 'woo-checkout-field-editor-pro'),
37
  'manage_woocommerce', 'checkout_form_designer', array($this, 'the_designer'));
38
 
39
  add_action('admin_print_scripts-'. $this->screen_id, array($this, 'enqueue_admin_scripts'));
44
  */
45
  public function add_screen_id($ids){
46
  $ids[] = 'woocommerce_page_checkout_form_designer';
47
+ $ids[] = strtolower(__('WooCommerce', 'woo-checkout-field-editor-pro')) .'_page_checkout_form_designer';
48
 
49
  return $ids;
50
  }
51
 
52
  public function add_settings_link($links) {
53
+ $settings_link = '<a href="'.admin_url('admin.php?page=checkout_form_designer').'">'. __('Settings', 'woo-checkout-field-editor-pro') .'</a>';
54
  array_unshift($links, $settings_link);
55
  return $links;
56
  }
99
  delete_option('wc_fields_billing');
100
  delete_option('wc_fields_shipping');
101
  delete_option('wc_fields_additional');
102
+ echo '<div class="updated"><p>'. __('SUCCESS: Checkout fields successfully reset', 'woo-checkout-field-editor-pro') .'</p></div>';
103
  }
104
 
105
  public function is_reserved_field_name( $field_name ){
125
  }
126
  return false;
127
  }
128
+
129
+ public function is_valid_field($field){
130
+ $return = false;
131
+ if(is_array($field)){
132
+ $return = true;
133
+ }
134
+ return $return;
135
+ }
136
+
137
+ public function is_enabled($field){
138
+ $return = false;
139
+ if(isset($field['enabled']) && $field['enabled']){
140
+ $return = true;
141
+ }
142
+ return $return;
143
+ }
144
+
145
+ public function is_custom_field($field){
146
+ $return = false;
147
+ if(isset($field['custom']) && $field['custom']){
148
+ $return = true;
149
+ }
150
+ return $return;
151
+ }
152
+
153
+ public function display_fields_in_admin_order($order, $fields, $prefix_html = ''){
154
+ if(is_array($fields)){
155
+ $html = '';
156
+
157
+ $order_id = false;
158
+ if(thwcfd_woocommerce_version_check()){
159
+ $order_id = $order->get_id();
160
+ }else{
161
+ $order_id = $order->id;
162
+ }
163
+
164
+ foreach($fields as $name => $field){
165
+ if($this->is_valid_field($field) && $this->is_custom_field($field) && $this->is_enabled($field) && $field['show_in_order']){
166
+ $value = get_post_meta( $order_id, $name, true );
167
+ if(!empty($value)){
168
+ $label = !empty($field['label']) ? __( $field['label'], 'woo-checkout-field-editor-pro' ) : $name;
169
+ $html .= '<p><strong>'. $label .':</strong><br/> '. wptexturize($value) .'</p>';
170
+ }
171
+ }
172
+ }
173
+
174
+ if($html){
175
+ echo $prefix_html.$html;
176
+ }
177
+ }
178
+ }
179
+
180
+ public function order_data_after_order_details($order){
181
+ $fields = $this->get_fields('additional');
182
+ $this->display_fields_in_admin_order($order, $fields, '<p>&nbsp;</p>');
183
+ }
184
+
185
+ public function order_data_after_billing_address($order){
186
+ $fields = $this->get_fields('billing');
187
+ $this->display_fields_in_admin_order($order, $fields, '');
188
+ }
189
+
190
+ public function order_data_after_shipping_address($order){
191
+ $fields = $this->get_fields('shipping');
192
+ $this->display_fields_in_admin_order($order, $fields, '');
193
+ }
194
 
195
  /**
196
  * Save Data function.
459
  $active = ( $key == $section ) ? 'current' : '';
460
  $url = 'admin.php?page=checkout_form_designer&tab=fields&section='.$key;
461
  echo '<li>';
462
+ echo '<a href="'.admin_url($url).'" class="'.$active.'" >'.ucwords($key).' '.__('Fields', 'woo-checkout-field-editor-pro').'</a>';
463
  echo ($size > $i) ? ' | ' : '';
464
  echo '</li>';
465
  }
500
  public function render_actions_row($section){
501
  ?>
502
  <th colspan="6">
503
+ <button type="button" class="button button-primary" onclick="openNewFieldForm('<?php echo $section; ?>')">+ <?php _e( 'Add field', 'woo-checkout-field-editor-pro' ); ?></button>
504
+ <button type="button" class="button" onclick="removeSelectedFields()"><?php _e( 'Remove', 'woo-checkout-field-editor-pro' ); ?></button>
505
+ <button type="button" class="button" onclick="enableSelectedFields()"><?php _e( 'Enable', 'woo-checkout-field-editor-pro' ); ?></button>
506
+ <button type="button" class="button" onclick="disableSelectedFields()"><?php _e( 'Disable', 'woo-checkout-field-editor-pro' ); ?></button>
507
  </th>
508
  <th colspan="4">
509
+ <input type="submit" name="save_fields" class="button-primary" value="<?php _e( 'Save changes', 'woo-checkout-field-editor-pro' ) ?>" style="float:right" />
510
+ <input type="submit" name="reset_fields" class="button" value="<?php _e( 'Reset to default fields', 'woo-checkout-field-editor-pro' ) ?>" style="float:right; margin-right: 5px;"
511
  onclick="return confirm('Are you sure you want to reset to default fields? all your changes will be deleted.');"/>
512
  </th>
513
  <?php
658
  <td class="td_enabled status"><?php echo($options['enabled'] == 1 ? '<span class="dashicons dashicons-yes tips" data-tip="Yes"></span>' : '-' ) ?></td>
659
  <td class="td_edit">
660
  <button type="button" class="f_edit_btn" <?php echo($options['enabled'] == 1 ? '' : 'disabled') ?>
661
+ onclick="openEditFieldForm(this,<?php echo $i; ?>)"><?php _e( 'Edit', 'woo-checkout-field-editor-pro' ); ?></button>
662
  </td>
663
  </tr>
664
  <?php $i++; endforeach; ?>
786
  $result = update_option( 'wc_fields_' . $section, $fields );
787
 
788
  if ( $result == true ) {
789
+ echo '<div class="updated"><p>' . __( 'Your changes were saved.', 'woo-checkout-field-editor-pro' ) . '</p></div>';
790
  } else {
791
+ echo '<div class="error"><p> ' . __( 'Your changes were not saved due to an error (or you made none!).', 'woo-checkout-field-editor-pro' ) . '</p></div>';
792
  }
793
  }
794
 
languages/woo-checkout-field-editor-pro.pot ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2019 Checkout Field Editor for WooCommerce
2
+ # This file is distributed under the same license as the Checkout Field Editor for WooCommerce package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Checkout Field Editor for WooCommerce 1.3.2\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-checkout-field-editor-pro\n"
7
+ "POT-Creation-Date: 2019-07-12 12:34:37+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: classes/class-wc-checkout-field-editor.php:30
16
+ msgid "WooCommerce Checkout Form Designer"
17
+ msgstr ""
18
+
19
+ #: classes/class-wc-checkout-field-editor.php:30
20
+ msgid "Checkout Form"
21
+ msgstr ""
22
+
23
+ #: classes/class-wc-checkout-field-editor.php:47
24
+ msgid "Settings"
25
+ msgstr ""
26
+
27
+ #: classes/class-wc-checkout-field-editor.php:96
28
+ msgid "SUCCESS: Checkout fields successfully reset"
29
+ msgstr ""
30
+
31
+ #: classes/class-wc-checkout-field-editor.php:390
32
+ msgid "Fields"
33
+ msgstr ""
34
+
35
+ #: classes/class-wc-checkout-field-editor.php:431
36
+ msgid "+ Add field"
37
+ msgstr ""
38
+ msgid "Add field"
39
+ msgstr ""
40
+
41
+ #: classes/class-wc-checkout-field-editor.php:432
42
+ msgid "Remove"
43
+ msgstr ""
44
+
45
+ #: classes/class-wc-checkout-field-editor.php:433
46
+ msgid "Enable"
47
+ msgstr ""
48
+
49
+ #: classes/class-wc-checkout-field-editor.php:434
50
+ msgid "Disable"
51
+ msgstr ""
52
+
53
+ #: classes/class-wc-checkout-field-editor.php:437
54
+ msgid "Save changes"
55
+ msgstr ""
56
+
57
+ #: classes/class-wc-checkout-field-editor.php:438
58
+ msgid "Reset to default fields"
59
+ msgstr ""
60
+
61
+ #: classes/class-wc-checkout-field-editor.php:589
62
+ msgid "Edit"
63
+ msgstr ""
64
+
65
+ #: classes/class-wc-checkout-field-editor.php:717
66
+ msgid "Your changes were saved."
67
+ msgstr ""
68
+
69
+ #: classes/class-wc-checkout-field-editor.php:719
70
+ msgid "Your changes were not saved due to an error (or you made none!)."
71
+ msgstr ""
72
+ #. Plugin Name of the plugin/theme
73
+ msgid "Checkout Field Editor for WooCommerce"
74
+ msgstr ""
75
+
76
+ #. Description of the plugin/theme
77
+ msgid "Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields)."
78
+ msgstr ""
79
+
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 4.0
6
- Tested up to: 5.2.1
7
- Stable tag: 1.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -143,6 +143,10 @@ Yes. There is a button 'reset to default fields' to go back to the WooCommerce d
143
  8. Newly added field
144
 
145
  == Changelog ==
 
 
 
 
146
  = 1.3.2 =
147
  * WooCommerce version 3.6.1 compatibility added.
148
 
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: 4.0
6
+ Tested up to: 5.2.2
7
+ Stable tag: 1.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
143
  8. Newly added field
144
 
145
  == Changelog ==
146
+ = 1.3.3 =
147
+ * Displaying customer fields in "Order details" section in admin order detail page.
148
+ * Language file(pot) added.
149
+
150
  = 1.3.2 =
151
  * WooCommerce version 3.6.1 compatibility added.
152