WooCommerce Checkout Manager - Version 3.5.9

Version Description

Bug fix.

=

Download this release

Release Info

Developer Emark
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 3.5.9
Comparing to
See all releases

Code changes from version 3.5.81 to 3.5.9

Files changed (3) hide show
  1. readme.txt +54 -32
  2. script_wccs.js +92 -112
  3. woocommerce-checkout-manager.php +1084 -1435
readme.txt CHANGED
@@ -1,42 +1,64 @@
1
- === WooCommerce Checkout Manager ===
2
- Contributors: Emark
3
  Donate link: http://www.trottyzone.com/donation/
4
  Tags: woocommerce, checkout settings, remove fields, shipping, order, fields, checkout page, checkout field, checkout manager, required remove, woocommerce checkout manager, checkout, checkout field editor, field editor, woocommerce custom checkout options , custom checkout, checkout option, field, payment, sell, buy, pay, tax, notice, re-order, order, new field, save field, manager, options, field editor
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
- Stable tag: 3.5.81
8
- License: GPLv2 or later
9
-
10
  Manages WooCommerce Checkout
11
-
12
-
13
  == Description ==
14
-
15
  This is a WooCommerce extension plugin that targets the checkout processes in which goods are bought. This plugin gives you a vast amount of capabilities to manage your products on checkout such as removing fields that you do not need, removing the required attribute rendering the field optional to customer or even perhaps adding more fields to the checkout page. This plugin certainly can.
16
-
17
-
18
- = FEATURES =
19
-
20
- * Add or Remove the required asterisk from fields on checkout page.
21
-
22
- * Make checkout fields completely optional for the customer to fill out.
23
-
24
- * Add new fields to the checkout page.
25
-
26
- * Four ( 4 ) fields types included: Text Input + Check Box + Select Options + Date Picker
27
-
28
  * Re-order new fields.
29
-
30
- * Added fields will appear on Order Summary and Receipt under “Additional information.”
31
-
32
- * Enable/ Disable "Additional information" name on the Order Summary and Receipt.
33
-
34
- = PRO VERSION =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  = REMOVING FIELDS =
37
  Removing fields became easier now, all you have to do is tick which box or which boxes that you do not want to show on the checkout page and it will be removed.
38
- Also you have the ability to not just remove the field alone but also remove the required (asterisk) attribute from the field. Leaving the field optional for the customer to fill out.
39
-
40
  = ADD NEW FIELDS =
41
  Now that everyone finds that the default fields are not just quite enough, with this plugin you can solve that by adding new fields with different types. All you have to do is click the "Add New field" button and a drop down box will show allowing you to set the new field name which is "Label" and to set the example in the field which is "Placeholder" plus select different types of fields.
42
 
@@ -49,14 +71,14 @@ Another type is the date field, has a great design, where when you click the fie
49
  One of the types of fields you can add is the options field, where you can insert your options to be selected on checkout as a drop down "select".
50
 
51
  = CHECK BOX =
52
- Checkbox another field type that Outputs specific value when ticked else fall back value. :)
53
 
54
  = RE-ORDER FIELDS =
55
  Re-order the fields on the checkout page from the Administration Menu by simple drag and drop on top of each other, or below each other of each new field created. This re-positions added new fields on the checkout.
56
 
57
  = ADDITIONAL TITLE =
58
  Prompts the customer that their are additional information that is required or optional to fill in.
59
- Two checkboxes are located above "Add New Field Section" one to remove the title for Checkout Page and other to remove it on the checkout details and receipt.
60
 
61
 
62
  = INCLUDED TRANSLATIONS =
@@ -201,7 +223,7 @@ Translations updated
201
  Included translations - Vietnamse, Italian, European Portuguese, Brazilian Portuguese
202
  Layout fixed on Order Summary Page
203
 
204
- = 3.5.7 =
205
  == Changelog ==
206
 
207
  = 1.0 =
@@ -290,4 +312,4 @@ Translations updated
290
 
291
  = 3.5.6 =
292
  Included translations - Vietnamse, Italian, European Portuguese, Brazilian Portuguese
293
- Layout fixed on Order Summary Page
1
+ === WooCommerce Checkout Manager ===
2
+
3
  Donate link: http://www.trottyzone.com/donation/
4
  Tags: woocommerce, checkout settings, remove fields, shipping, order, fields, checkout page, checkout field, checkout manager, required remove, woocommerce checkout manager, checkout, checkout field editor, field editor, woocommerce custom checkout options , custom checkout, checkout option, field, payment, sell, buy, pay, tax, notice, re-order, order, new field, save field, manager, options, field editor
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
+ Stable tag: 3.5.9
8
+ License: GPLv2 or later
 
9
  Manages WooCommerce Checkout
 
 
10
  == Description ==
 
11
  This is a WooCommerce extension plugin that targets the checkout processes in which goods are bought. This plugin gives you a vast amount of capabilities to manage your products on checkout such as removing fields that you do not need, removing the required attribute rendering the field optional to customer or even perhaps adding more fields to the checkout page. This plugin certainly can.
12
+ = FEATURES =
13
+
 
 
 
 
 
 
 
 
 
 
14
  * Re-order new fields.
15
+ * Add new fields to the checkout page.
16
+
17
+ * Add or Remove the required asterisk from fields on checkout page.
18
+
19
+ * Make checkout fields completely optional for the customer to fill out.
20
+
21
+ * Enable/ Disable "Additional information" name on the Order Summary and Receipt.
22
+
23
+ * Four ( 4 ) fields types included: Text Input + Check Box + Select Options + Date Picker
24
+ * Added fields will appear on Order Summary and Receipt under “Additional information.”
25
+ = PRO VERSION =
26
+ = More Features =
27
+ * Create Conditional Fields.
28
+
29
+ * Create Conditional field to allow customer to Remove Tax (Tax Exempt).
30
+
31
+ * Create Conditional field to allow customer to Add Amount on checkout.
32
+ (Pre-defined by admin OR Customer Can Enter Any Amount).
33
+
34
+ * Make both Shipping and Billing Address fields Optional.
35
+
36
+ * Upload files for each order for both Customers and Admins.
37
+
38
+ * Show or Hide added field for Specific Product or Category Only.
39
+
40
+ * Display Payment Method and Shipping Method used on checkout.
41
+
42
+ * Disable any added field from Checkout details page and Order Receipt.
43
+
44
+ * Retain Fields Information for customers when they navigate back and forth from checkout.
45
+
46
+ * Disable Billing Address fields for chosen shipping goods. Which makes them visible only for virtual goods.
47
+
48
+ * Change the default DatePicker format: (dd-mm-yy) to another format (example. mm-dd-yy).
49
+
50
+ * DatePicker: Set Minimum Date and Maximum Date.
51
+
52
+ * DatePicker: Disable days in the week.
53
+
54
+ * Area to insert your own Custom CSS.
55
+
56
+ * Set default State for checkout.
57
+
58
 
59
  = REMOVING FIELDS =
60
  Removing fields became easier now, all you have to do is tick which box or which boxes that you do not want to show on the checkout page and it will be removed.
61
+ Also you have the ability to not just remove the field alone but also remove the required (asterisk) attribute from the field. Leaving the field optional for the customer to fill out.
 
62
  = ADD NEW FIELDS =
63
  Now that everyone finds that the default fields are not just quite enough, with this plugin you can solve that by adding new fields with different types. All you have to do is click the "Add New field" button and a drop down box will show allowing you to set the new field name which is "Label" and to set the example in the field which is "Placeholder" plus select different types of fields.
64
 
71
  One of the types of fields you can add is the options field, where you can insert your options to be selected on checkout as a drop down "select".
72
 
73
  = CHECK BOX =
74
+ CheckBox another field type that Outputs specific value when ticked else fall back value. :)
75
 
76
  = RE-ORDER FIELDS =
77
  Re-order the fields on the checkout page from the Administration Menu by simple drag and drop on top of each other, or below each other of each new field created. This re-positions added new fields on the checkout.
78
 
79
  = ADDITIONAL TITLE =
80
  Prompts the customer that their are additional information that is required or optional to fill in.
81
+ Two CheckBoxes are located above "Add New Field Section" one to remove the title for Checkout Page and other to remove it on the checkout details and receipt.
82
 
83
 
84
  = INCLUDED TRANSLATIONS =
223
  Included translations - Vietnamse, Italian, European Portuguese, Brazilian Portuguese
224
  Layout fixed on Order Summary Page
225
 
226
+ = 3.5.7 =
227
  == Changelog ==
228
 
229
  = 1.0 =
312
 
313
  = 3.5.6 =
314
  Included translations - Vietnamse, Italian, European Portuguese, Brazilian Portuguese
315
+ Layout fixed on Order Summary Page
script_wccs.js CHANGED
@@ -1,113 +1,93 @@
1
- jQuery(document).ready(function() {
2
- jQuery(function() {
3
- jQuery('#select_all_rm').click(function() {
4
- var c = this.checked;
5
- jQuery('.rm').prop('checked',c);
6
- });
7
- });
8
- });
9
-
10
- jQuery(document).ready(function() {
11
- jQuery(function() {
12
- jQuery('#select_all_rm_s').click(function() {
13
- var c = this.checked;
14
- jQuery('.rm_s').prop('checked',c);
15
- });
16
- });
17
- });
18
-
19
- jQuery(document).ready(function() {
20
- jQuery(function() {
21
- jQuery('#select_all_rq').click(function() {
22
- var c = this.checked;
23
- jQuery('.rq').prop('checked',c);
24
- });
25
- });
26
- });
27
-
28
- jQuery(document).ready(function() {
29
- jQuery(function() {
30
- jQuery('#select_all_rq_s').click(function() {
31
- var c = this.checked;
32
- jQuery('.rq_s').prop('checked',c);
33
- });
34
- });
35
- });
36
-
37
- // Javascript for adding new field
38
- jQuery(document).ready( function() {
39
-
40
- /**
41
- * Credits to the Advanced Custom Fields plugin for this code
42
- */
43
-
44
- // Update Order Numbers
45
- function update_order_numbers(div) {
46
- div.children('tbody').children('tr.wccs-row').each(function(i) {
47
- jQuery(this).children('td.wccs-order').html(i+1);
48
- });
49
- }
50
-
51
- // Make Sortable
52
- function make_sortable(div){
53
- var fixHelper = function(e, ui) {
54
- ui.children().each(function() {
55
- jQuery(this).width(jQuery(this).width());
56
- });
57
- return ui;
58
- };
59
-
60
- div.children('tbody').unbind('sortable').sortable({
61
- update: function(event, ui){
62
- update_order_numbers(div);
63
- },
64
- handle: 'td.wccs-order',
65
- helper: fixHelper
66
- });
67
- }
68
-
69
- var div = jQuery('.wccs-table'),
70
- row_count = div.children('tbody').children('tr.wccs-row').length;
71
-
72
- // Make the table sortable
73
- make_sortable(div);
74
-
75
- // Add button
76
- jQuery('#wccs-add-button').live('click', function(){
77
-
78
- var div = jQuery('.wccs-table'),
79
- row_count = div.children('tbody').children('tr.wccs-row').length,
80
- new_field = div.children('tbody').children('tr.wccs-clone').clone(false); // Create and add the new field
81
-
82
- new_field.attr( 'class', 'wccs-row' );
83
-
84
- // Update names
85
- new_field.find('[name]').each(function(){
86
- var count = parseInt(row_count);
87
- var name = jQuery(this).attr('name').replace('[999]','[' + count + ']');
88
- jQuery(this).attr('name', name);
89
- });
90
-
91
- // Add row
92
- div.children('tbody').append(new_field);
93
- update_order_numbers(div);
94
-
95
- // There is now 1 more row
96
- row_count ++;
97
-
98
- return false;
99
- });
100
-
101
- // Remove button
102
- jQuery('.wccs-table .wccs-remove-button').live('click', function(){
103
- var div = jQuery('.wccs-table'),
104
- tr = jQuery(this).closest('tr');
105
-
106
- tr.animate({'left' : '50px', 'opacity' : 0}, 250, function(){
107
- tr.remove();
108
- update_order_numbers(div);
109
- });
110
-
111
- return false;
112
- });
113
  });
1
+ jQuery(document).ready(function() {
2
+ jQuery(function() {
3
+ jQuery('#select_all_rm').click(function() {
4
+ var c = this.checked;
5
+ jQuery('.rm').prop('checked',c);
6
+ });
7
+ });
8
+ });
9
+ jQuery(document).ready(function() {
10
+ jQuery(function() {
11
+ jQuery('#select_all_rm_s').click(function() {
12
+ var c = this.checked;
13
+ jQuery('.rm_s').prop('checked',c);
14
+ });
15
+ });
16
+ });
17
+ jQuery(document).ready(function() {
18
+ jQuery(function() {
19
+ jQuery('#select_all_rq').click(function() {
20
+ var c = this.checked;
21
+ jQuery('.rq').prop('checked',c);
22
+ });
23
+ });
24
+ });
25
+ jQuery(document).ready(function() {
26
+ jQuery(function() {
27
+ jQuery('#select_all_rq_s').click(function() {
28
+ var c = this.checked;
29
+ jQuery('.rq_s').prop('checked',c);
30
+ });
31
+ });
32
+ });
33
+ // Javascript for adding new field
34
+ jQuery(document).ready( function() {
35
+ /**
36
+ * Credits to the Advanced Custom Fields plugin for this code
37
+ */
38
+ // Update Order Numbers
39
+ function update_order_numbers(div) {
40
+ div.children('tbody').children('tr.wccs-row').each(function(i) {
41
+ jQuery(this).children('td.wccs-order').html(i+1);
42
+ });
43
+ }
44
+ // Make Sortable
45
+ function make_sortable(div){
46
+ var fixHelper = function(e, ui) {
47
+ ui.children().each(function() {
48
+ jQuery(this).width(jQuery(this).width());
49
+ });
50
+ return ui;
51
+ };
52
+ div.children('tbody').unbind('sortable').sortable({
53
+ update: function(event, ui){
54
+ update_order_numbers(div);
55
+ },
56
+ handle: 'td.wccs-order',
57
+ helper: fixHelper
58
+ });
59
+ }
60
+ var div = jQuery('.wccs-table'),
61
+ row_count = div.children('tbody').children('tr.wccs-row').length;
62
+ // Make the table sortable
63
+ make_sortable(div);
64
+ // Add button
65
+ jQuery('#wccs-add-button').live('click', function(){
66
+ var div = jQuery('.wccs-table'),
67
+ row_count = div.children('tbody').children('tr.wccs-row').length,
68
+ new_field = div.children('tbody').children('tr.wccs-clone').clone(false); // Create and add the new field
69
+ new_field.attr( 'class', 'wccs-row' );
70
+ // Update names
71
+ new_field.find('[name]').each(function(){
72
+ var count = parseInt(row_count);
73
+ var name = jQuery(this).attr('name').replace('[999]','[' + count + ']');
74
+ jQuery(this).attr('name', name);
75
+ });
76
+ // Add row
77
+ div.children('tbody').append(new_field);
78
+ update_order_numbers(div);
79
+ // There is now 1 more row
80
+ row_count ++;
81
+ return false;
82
+ });
83
+ // Remove button
84
+ jQuery('.wccs-table .wccs-remove-button').live('click', function(){
85
+ var div = jQuery('.wccs-table'),
86
+ tr = jQuery(this).closest('tr');
87
+ tr.animate({'left' : '50px', 'opacity' : 0}, 250, function(){
88
+ tr.remove();
89
+ update_order_numbers(div);
90
+ });
91
+ return false;
92
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  });
woocommerce-checkout-manager.php CHANGED
@@ -1,1436 +1,1085 @@
1
- <?php
2
- /*
3
-
4
- Plugin Name: WooCommerce Checkout Manager
5
- Plugin URI: http://www.trottyzone.com/product/woocommerce-checkout-manager-pro
6
- Description: Manages WooCommerce Checkout fields
7
- Version: 3.5.81
8
- Author: Ephrain Marchan
9
- Author URI: http://www.trottyzone.com
10
- License: GPLv2 or later
11
- */
12
-
13
- /*
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
-
29
- */
30
-
31
-
32
- if ( ! defined( 'ABSPATH' ) ) die();
33
-
34
- register_activation_hook( __FILE__, 'wccs_install' );
35
-
36
-
37
- load_plugin_textdomain('woocommerce-checkout-manager', false, dirname(plugin_basename(__FILE__)) . '/languages/');
38
-
39
- function wccs_install() {
40
- $defaults = array( 'buttons' => array( array(
41
- 'label' => __( 'Example Label', 'woocommerce-checkout-manager' ),
42
- 'placeholder' => __( 'Example placeholder', 'woocommerce-checkout-manager' ),
43
- 'cow' => __('myfld1', 'woocommerce-checkout-manager'),
44
- 'option_a' => __('option 1', 'woocommerce-checkout-manager'),
45
- 'option_b' => __('option 2', 'woocommerce-checkout-manager')
46
-
47
- )
48
- ),
49
- 'checkness' => array(
50
- 'checkbox1' => true,
51
- 'checkbox12' => true
52
- )
53
- );
54
-
55
- add_option( 'wccs_settings', apply_filters( 'wccs_defaults', $defaults ) );
56
- }
57
-
58
- // Hook for adding admin menus
59
- if ( is_admin() ){ // admin actions
60
-
61
- // Hook for adding admin menu
62
- add_action( 'admin_menu', 'wccs_admin_menu' );
63
-
64
-
65
- // Display the 'Settings' link in the plugin row on the installed plugins list page
66
- add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'wccs_admin_plugin_actions', -10);
67
-
68
- add_action( 'admin_init', 'wccs_register_setting' );
69
-
70
-
71
- } else { // non-admin enqueues, actions, and filters
72
- // hook to get option values and dynamically render css to support the tab classes
73
-
74
- wp_enqueue_script('jquery-ui-datepicker');
75
- wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
76
-
77
- }
78
-
79
-
80
- // action function for above hook
81
- function wccs_admin_menu() {
82
-
83
- // Add a new submenu under Settings:
84
- add_options_page( __('WooCommerce Checkout Manager', 'woocommerce-checkout-manager'), __('WooCommerce Checkout Manager', 'woocommerce-checkout-manager'), 'manage_options', __FILE__ , 'wccs__options_page');
85
-
86
- }
87
-
88
- function wccs_register_setting() {
89
- register_setting( 'wccs_options', 'wccs_settings', 'wccs_options_validate' );
90
- }
91
-
92
-
93
- // fc_settings_page() displays the page content
94
- function wccs__options_page() {
95
-
96
- //must check that the user has the required capability
97
- if (!current_user_can('manage_options'))
98
- {
99
- wp_die( __('You do not have sufficient permissions to access this page.') );
100
- }
101
-
102
-
103
- // variables for the field and option names
104
- $hidden_field_name = 'mccs_submit_hidden';
105
-
106
-
107
- // read options values
108
- $options = get_option( 'wccs_settings' );
109
-
110
- if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
111
-
112
- // Save the posted value in the database
113
- update_option( 'wccs_settings', $options );
114
-
115
- ?>
116
-
117
- <div class="updated"><p><strong><?php _e('settings saved.'); ?></strong></p></div>
118
-
119
- <?php
120
-
121
- }
122
-
123
-
124
-
125
- // Now display the settings editing screen
126
-
127
- echo '<div class="wrap">';
128
-
129
- // icon for settings
130
- echo '<div id="icon-themes" class="icon32"><br></div>';
131
-
132
- // header
133
-
134
- echo "<h2>" . __( 'WooCommerce Checkout Manager', 'woocommerce-checkout-manager' ) . "</h2>";
135
-
136
- // settings form
137
-
138
- ?>
139
-
140
-
141
- <div style="padding:5px 10px;float:right;font-weight:700;color:green;" class="updated">
142
- <?php _e('Found this Plugin Useful? Why not Buy me a ', 'woocommerce-checkout-manager'); ?><a href="http://www.trottyzone.com/donation/"><?php _e('beer', 'woocommerce-checkout-manager'); ?></a> <?php _e('to say thanks for the awesome coding.', 'woocommerce-checkout-manager'); ?>
143
- </div>
144
-
145
-
146
- <form name="form" method="post" action="options.php" id="frm1">
147
-
148
- <?php
149
- settings_fields( 'wccs_options' );
150
- $options = get_option( 'wccs_settings' );
151
- ?>
152
-
153
-
154
-
155
- <table class="widefat" border="1" >
156
-
157
- <thead>
158
- <tr>
159
- <th><?php _e('Field Name', 'woocommerce-checkout-manager'); ?></th>
160
- <th><?php _e('Remove Field Entirely', 'woocommerce-checkout-manager'); ?></th>
161
- <th><?php _e('Remove Required Attribute', 'woocommerce-checkout-manager'); ?></th>
162
- <th class="wccs_replace"><?php _e('Replace Label Name', 'woocommerce-checkout-manager'); ?></th>
163
- <th class="wccs_replace"><?php _e('Replace Placeholder Name', 'woocommerce-checkout-manager'); ?></th>
164
- </tr>
165
- </thead>
166
-
167
-
168
- <tbody>
169
- <tr>
170
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
171
- <td><strong><?php _e('Select All Check boxes in this Column', 'woocommerce-checkout-manager'); ?></strong></td>
172
- <td><input name="wccs_settings[checkness][select_all_rm]" type="checkbox" id="select_all_rm" value="1" <?php if ( 1 == ($options['checkness']['select_all_rm'])) echo "checked='checked'"; ?> /></td>
173
- <td><input name="wccs_settings[checkness][select_all_rq]" type="checkbox" id="select_all_rq" value="1" <?php if ( 1 == ($options['checkness']['select_all_rq'])) echo "checked='checked'"; ?> /></td>
174
- <td></td>
175
- <td></td>
176
- </tr>
177
- </tbody>
178
-
179
- <tbody>
180
- <tr>
181
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
182
- <td><?php _e('First Name', 'woocommerce-checkout-manager'); ?></td>
183
- <td><input name="wccs_settings[checkness][wccs_opt_1]" type="checkbox" class="rm" value="1"
184
- <?php if ( 1 == ($options['checkness']['wccs_opt_1']) ) echo 'checked="checked"'; ?> /></td>
185
-
186
- <td><input name="wccs_settings[checkness][wccs_rq_1]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_1'])) echo "checked='checked'"; ?> /></td>
187
-
188
- <td><input type="text" name="wccs_settings[replace][label]"
189
- value="<?php echo esc_attr( $options['replace']['label'] ); ?>" /></td>
190
-
191
- <td><input type="text" name="wccs_settings[replace][placeholder]"
192
- value="<?php echo esc_attr( $options['replace']['placeholder'] ); ?>" /></td>
193
- </tr>
194
- </tbody>
195
-
196
- <tbody>
197
- <tr>
198
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
199
- <td><?php _e('Last Name', 'woocommerce-checkout-manager'); ?></td>
200
- <td><input name="wccs_settings[checkness][wccs_opt_2]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_2'])) echo "checked='checked'"; ?> /></td>
201
- <td><input name="wccs_settings[checkness][wccs_rq_2]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_2'])) echo "checked='checked'"; ?> /></td>
202
-
203
- <td><input type="text" name="wccs_settings[replace][label1]"
204
- value="<?php echo esc_attr( $options['replace']['label1'] ); ?>" /></td>
205
-
206
- <td><input type="text" name="wccs_settings[replace][placeholder1]"
207
- value="<?php echo esc_attr( $options['replace']['placeholder1'] ); ?>" /></td>
208
- </tr>
209
- </tbody>
210
-
211
- <tbody>
212
- <tr>
213
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
214
- <td><?php _e('Country', 'woocommerce-checkout-manager'); ?></td>
215
- <td><input name="wccs_settings[checkness][wccs_opt_8]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_8'])) echo "checked='checked'"; ?> /></td>
216
- <td><input name="wccs_settings[checkness][wccs_rq_8]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_8'])) echo "checked='checked'"; ?> /></td>
217
-
218
- <td><input type="text" name="wccs_settings[replace][label2]"
219
- value="<?php echo esc_attr( $options['replace']['label2'] ); ?>" /></td>
220
- <td></td>
221
- </tr>
222
- </tbody>
223
-
224
- <tbody>
225
- <tr>
226
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
227
- <td><?php _e('Phone', 'woocommerce-checkout-manager'); ?></td>
228
- <td><input name="wccs_settings[checkness][wccs_opt_10]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_10'])) echo "checked='checked'"; ?> /></td>
229
- <td><input name="wccs_settings[checkness][wccs_rq_10]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_10'])) echo "checked='checked'"; ?> /></td>
230
-
231
- <td><input type="text" name="wccs_settings[replace][label3]"
232
- value="<?php echo esc_attr( $options['replace']['label3'] ); ?>" /></td>
233
-
234
- <td><input type="text" name="wccs_settings[replace][placeholder3]"
235
- value="<?php echo esc_attr( $options['replace']['placeholder3'] ); ?>" /></td>
236
- </tr>
237
- </tbody>
238
-
239
- <tbody>
240
- <tr>
241
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
242
- <td><?php _e('Email', 'woocommerce-checkout-manager'); ?></td>
243
- <td><input name="wccs_settings[checkness][wccs_opt_11]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_11'])) echo "checked='checked'"; ?> /></td>
244
- <td><input name="wccs_settings[checkness][wccs_rq_11]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_11'])) echo "checked='checked'"; ?> /></td>
245
-
246
- <td><input type="text" name="wccs_settings[replace][label4]"
247
- value="<?php echo esc_attr( $options['replace']['label4'] ); ?>" /></td>
248
-
249
- <td><input type="text" name="wccs_settings[replace][placeholder4]"
250
- value="<?php echo esc_attr( $options['replace']['placeholder4'] ); ?>" /></td>
251
- </tr>
252
- </tbody>
253
-
254
-
255
- <tbody>
256
- <tr>
257
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
258
- <td><?php _e('Company', 'woocommerce-checkout-manager'); ?></td>
259
- <td><input name="wccs_settings[checkness][wccs_opt_3]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_3'])) echo "checked='checked'"; ?> /></td>
260
- <td></td>
261
-
262
- <td><input type="text" name="wccs_settings[replace][label5]"
263
- value="<?php echo esc_attr( $options['replace']['label5'] ); ?>" /></td>
264
-
265
- <td><input type="text" name="wccs_settings[replace][placeholder5]"
266
- value="<?php echo esc_attr( $options['replace']['placeholder5'] ); ?>" /></td>
267
- </tr>
268
- </tbody>
269
-
270
-
271
-
272
- <tbody>
273
- <tr>
274
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
275
- <td><?php _e('Order Comments', 'woocommerce-checkout-manager'); ?></td>
276
- <td><input name="wccs_settings[checkness][wccs_opt_12]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_12'])) echo "checked='checked'"; ?> /></td>
277
- <td></td>
278
-
279
- <td><input type="text" name="wccs_settings[replace][label11]"
280
- value="<?php echo esc_attr( $options['replace']['label11'] ); ?>" /></td>
281
-
282
- <td><input type="text" name="wccs_settings[replace][placeholder11]"
283
- value="<?php echo esc_attr( $options['replace']['placeholder11'] ); ?>" /></td>
284
- </tr>
285
- </tbody>
286
-
287
-
288
- <tbody>
289
- <tr>
290
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
291
- <td><?php _e('Address 1', 'woocommerce-checkout-manager'); ?></td>
292
- <td><input name="wccs_settings[checkness][wccs_opt_4]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_4'])) echo "checked='checked'"; ?></td>
293
- <td></td>
294
- <td></td>
295
- <td></td>
296
- </tr>
297
- </tbody>
298
-
299
- <tbody>
300
- <tr>
301
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
302
- <td><?php _e('Address 2', 'woocommerce-checkout-manager'); ?></td>
303
- <td><input name="wccs_settings[checkness][wccs_opt_5]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_5'])) echo "checked='checked'"; ?> /></td>
304
- <td></td>
305
- <td></td>
306
- <td></td>
307
- </tr>
308
- </tbody>
309
-
310
- <tbody>
311
- <tr>
312
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
313
- <td><?php _e('City', 'woocommerce-checkout-manager'); ?></td>
314
- <td><input name="wccs_settings[checkness][wccs_opt_6]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_6'])) echo "checked='checked'"; ?> /></td>
315
- <td></td>
316
- <td></td>
317
- <td></td>
318
- </tr>
319
- </tbody>
320
-
321
- <tbody>
322
- <tr>
323
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
324
- <td><?php _e('Postal Code', 'woocommerce-checkout-manager'); ?></td>
325
- <td><input name="wccs_settings[checkness][wccs_opt_7]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_7'])) echo "checked='checked'"; ?> /></td>
326
- <td></td>
327
- <td></td>
328
- <td></td>
329
- </tr>
330
- </tbody>
331
-
332
-
333
-
334
- <tbody>
335
- <tr>
336
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
337
- <td><?php _e('State', 'woocommerce-checkout-manager'); ?></td>
338
- <td><input name="wccs_settings[checkness][wccs_opt_9]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_9'])) echo "checked='checked'"; ?> /></td>
339
- <td></td>
340
- <td></td>
341
- <td></td>
342
- </tr>
343
- </tbody>
344
-
345
-
346
- <?php submit_button( __( 'Save Changes', 'woocommerce-checkout-manager' ) ); ?>
347
-
348
- <div style="margin:5px 0 15px 10px;color:green;font-size:18px;float:left;">= <?php _e('Billing Section', 'woocommerce-checkout-manager'); ?> =</div>
349
- </table>
350
-
351
-
352
-
353
- <table class="widefat" border="1" >
354
-
355
- <thead>
356
- <tr>
357
- <th><?php _e('Field Name', 'woocommerce-checkout-manager'); ?></th>
358
- <th><?php _e('Remove Field Entirely', 'woocommerce-checkout-manager'); ?></th>
359
- <th><?php _e('Remove Required Attribute', 'woocommerce-checkout-manager'); ?></th>
360
- <th class="wccs_replace"><?php _e('Replace Label Name', 'woocommerce-checkout-manager'); ?></th>
361
- <th class="wccs_replace"><?php _e('Replace Placeholder Name', 'woocommerce-checkout-manager'); ?></th>
362
- </tr>
363
- </thead>
364
-
365
-
366
- <tbody>
367
- <tr>
368
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
369
- <td><strong><?php _e('Select All Check boxes in this Column', 'woocommerce-checkout-manager'); ?></strong></td>
370
- <td><input name="wccs_settings[check][select_all_rm_s]" type="checkbox" id="select_all_rm_s" value="1" <?php if ( 1 == ($options['check']['select_all_rm_s'])) echo "checked='checked'"; ?> /></td>
371
- <td><input name="wccs_settings[check][select_all_rq_s]" type="checkbox" id="select_all_rq_s" value="1" <?php if ( 1 == ($options['check']['select_all_rq_s'])) echo "checked='checked'"; ?> /></td>
372
- <td></td>
373
- <td></td>
374
- </tr>
375
- </tbody>
376
-
377
-
378
- <tbody>
379
- <tr>
380
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
381
- <td><?php _e('First Name', 'woocommerce-checkout-manager'); ?></td>
382
- <td><input name="wccs_settings[check][wccs_opt_1_s]" type="checkbox" class="rm_s" value="1"
383
- <?php if ( 1 == ($options['check']['wccs_opt_1_s']) ) echo 'checked="checked"'; ?> /></td>
384
-
385
- <td><input name="wccs_settings[check][wccs_rq_1_s]" type="checkbox" class="rq_s" value="1" <?php if ( 1 == ($options['check']['wccs_rq_1_s'])) echo "checked='checked'"; ?> /></td>
386
-
387
- <td><input type="text" name="wccs_settings[replace][label_s]"
388
- value="<?php echo esc_attr( $options['replace']['label_s'] ); ?>" /></td>
389
-
390
- <td><input type="text" name="wccs_settings[replace][placeholder_s]"
391
- value="<?php echo esc_attr( $options['replace']['placeholder_s'] ); ?>" /></td>
392
- </tr>
393
- </tbody>
394
-
395
- <tbody>
396
- <tr>
397
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
398
- <td><?php _e('Last Name', 'woocommerce-checkout-manager'); ?></td>
399
- <td><input name="wccs_settings[check][wccs_opt_2_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_2_s'])) echo "checked='checked'"; ?> /></td>
400
- <td><input name="wccs_settings[check][wccs_rq_2_s]" type="checkbox" class="rq_s" value="1" <?php if ( 1 == ($options['check']['wccs_rq_2_s'])) echo "checked='checked'"; ?> /></td>
401
-
402
- <td><input type="text" name="wccs_settings[replace][label_s1]"
403
- value="<?php echo esc_attr( $options['replace']['label_s1'] ); ?>" /></td>
404
-
405
- <td><input type="text" name="wccs_settings[replace][placeholder_s1]"
406
- value="<?php echo esc_attr( $options['replace']['placeholder_s1'] ); ?>" /></td>
407
- </tr>
408
- </tbody>
409
-
410
- <tbody>
411
- <tr>
412
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
413
- <td><?php _e('Company', 'woocommerce-checkout-manager'); ?></td>
414
- <td><input name="wccs_settings[check][wccs_opt_3_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_3_s'])) echo "checked='checked'"; ?> /></td>
415
- <td></td>
416
-
417
- <td><input type="text" name="wccs_settings[replace][label_s2]"
418
- value="<?php echo esc_attr( $options['replace']['label_s2'] ); ?>" /></td>
419
-
420
- <td><input type="text" name="wccs_settings[replace][placeholder_s2]"
421
- value="<?php echo esc_attr( $options['replace']['placeholder_s2'] ); ?>" /></td>
422
- </tr>
423
- </tbody>
424
-
425
-
426
- <tbody>
427
- <tr>
428
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
429
- <td><?php _e('Country', 'woocommerce-checkout-manager'); ?></td>
430
- <td><input name="wccs_settings[check][wccs_opt_8_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_8_s'])) echo "checked='checked'"; ?> /></td>
431
- <td></td>
432
-
433
- <td><input type="text" name="wccs_settings[replace][label_s7]"
434
- value="<?php echo esc_attr( $options['replace']['label_s7'] ); ?>" /></td>
435
-
436
- <td></td>
437
- </tr>
438
- </tbody>
439
-
440
-
441
- <tbody>
442
- <tr>
443
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
444
- <td><?php _e('Address 1', 'woocommerce-checkout-manager'); ?></td>
445
- <td><input name="wccs_settings[check][wccs_opt_4_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_4_s'])) echo "checked='checked'"; ?></td>
446
- <td></td>
447
-
448
- <td></td>
449
- <td></td>
450
- </tr>
451
- </tbody>
452
-
453
- <tbody>
454
- <tr>
455
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
456
- <td><?php _e('Address 2', 'woocommerce-checkout-manager'); ?></td>
457
- <td><input name="wccs_settings[check][wccs_opt_5_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_5_s'])) echo "checked='checked'"; ?> /></td>
458
- <td></td>
459
-
460
- <td></td>
461
- <td></td>
462
- </tr>
463
- </tbody>
464
-
465
- <tbody>
466
- <tr>
467
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
468
- <td><?php _e('City', 'woocommerce-checkout-manager'); ?></td>
469
- <td><input name="wccs_settings[check][wccs_opt_6_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_6_s'])) echo "checked='checked'"; ?> /></td>
470
- <td></td>
471
-
472
- <td></td>
473
- <td></td>
474
- </tr>
475
- </tbody>
476
-
477
- <tbody>
478
- <tr>
479
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
480
- <td><?php _e('Postal Code', 'woocommerce-checkout-manager'); ?></td>
481
- <td><input name="wccs_settings[check][wccs_opt_7_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_7_s'])) echo "checked='checked'"; ?> /></td>
482
- <td></td>
483
-
484
- <td></td>
485
- <td></td>
486
- </tr>
487
- </tbody>
488
-
489
-
490
- <tbody>
491
- <tr>
492
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
493
- <td><?php _e('State', 'woocommerce-checkout-manager'); ?></td>
494
- <td><input name="wccs_settings[check][wccs_opt_9_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_9_s'])) echo "checked='checked'"; ?> /></td>
495
- <td></td>
496
-
497
- <td></td>
498
- <td></td>
499
- </tr>
500
- </tbody>
501
-
502
-
503
- <div style="margin:20px 0 15px 10px;color:green;font-size:18px;float:left;">= <?php _e('Shipping Section', 'woocommerce-checkout-manager'); ?> =</div>
504
- </table>
505
-
506
- <div style="padding:5px 10px;float:right;font-weight:700;color:green;" class="updated">
507
- <a href="http://www.trottyzone.com/product/woocommerce-checkout-manager/"><?php _e('PRO VERSION', 'woocommerce-checkout-manager'); ?></a> <?php _e('- now includes text/ html swapper (change billing address text ++), checkbox (input own two options), select up to ten(10) more options and more!', 'woocommerce-checkout-manager'); ?>
508
- </div>
509
-
510
-
511
- <div style="margin:20px 0 15px 10px;color:green;font-size:18px;float:left;">= <?php _e('Add New Field Section', 'woocommerce-checkout-manager'); ?> =</div>
512
-
513
- <table class="widefat" border="1" >
514
-
515
- <thead>
516
- <tr>
517
-
518
- <th><?php _e('Enable Title - Additional information', 'atc-menu'); ?></th>
519
- <th>
520
- <input style="float:left;" name="wccs_settings[checkness][checkbox12]" type="checkbox" value="true" <?php if ( true == ($options['checkness']['checkbox12'])) echo "checked='checked'"; ?> /></th>
521
-
522
- <th><?php _e('Checkout Page', 'atc-menu'); ?></th>
523
-
524
- <th>
525
- <input style="float:left;" name="wccs_settings[checkness][checkbox1]" type="checkbox" value="true" <?php if ( true == ($options['checkness']['checkbox1'])) echo "checked='checked'"; ?> /></th>
526
-
527
- <th><?php _e('Checkout Details and Email Receipt', 'atc-menu'); ?></th>
528
-
529
- </tr>
530
-
531
- </thead>
532
-
533
- </table>
534
-
535
- <style type="text/css">
536
- .wccs-clone {
537
- display:none;
538
- }
539
- .widefat input {
540
- width:100%;
541
- }
542
- .wccs_replace {
543
- width: 20%;
544
- }
545
- .wccs-order {
546
- cursor:move;
547
- }
548
- .wccs-table > tbody > tr > td {
549
- background: #fff;
550
- border-right: 1px solid #ededed;
551
- border-bottom: 1px solid #ededed;
552
- padding: 8px;
553
- position: relative;
554
- }
555
-
556
- .wccs-table > tbody > tr:last-child td { border-bottom: 0 none; }
557
- .wccs-table > tbody > tr td:last-child { border-right: 0 none; }
558
- .wccs-table > thead > tr > th { border-right: 1px solid #e1e1e1; }
559
- .wccs-table > thead > tr > th:last-child { border-right: 0 none; }
560
-
561
- .wccs-table tr td.wccs-order,
562
- .wccs-table tr th.wccs-order {
563
- width: 16px;
564
- text-align: center;
565
- vertical-align: middle;
566
- color: #aaa;
567
- text-shadow: #fff 0 1px 0;
568
- }
569
-
570
- .wccs-table .wccs-remove {
571
- width: 16px;
572
- vertical-align: middle;
573
- }
574
- .wccs-table input[type="text"] {
575
- width: 100%;
576
- }
577
-
578
- .wccs-table-footer {
579
- position: relative;
580
- overflow: hidden;
581
- margin-top: 10px;
582
- padding: 8px 0;
583
- }
584
- </style>
585
-
586
- <table class="widefat wccs-table" border="1">
587
-
588
- <thead>
589
- <tr>
590
- <th style="width:5%;" class="wccs-order" title="<?php esc_attr_e( 'Change order' , 'woocommerce-checkout-manager' ); ?>"></th>
591
- <th><?php _e('Label' , 'woocommerce-checkout-manager' ); ?></th>
592
- <th><?php _e('Placeholder' , 'woocommerce-checkout-manager' ); ?></th>
593
- <th><?php _e('Option A' , 'woocommerce-checkout-manager' ); ?></th>
594
- <th><?php _e('Options B' , 'woocommerce-checkout-manager' ); ?></th>
595
- <th width="15%"><?php _e('Choose Type' , 'woocommerce-checkout-manager' ); ?></th>
596
- <th width="10%"><?php _e('Abbreviation' , 'woocommerce-checkout-manager' ); ?></th>
597
- <th width="12%"><?php _e('Required Attribute' , 'woocommerce-checkout-manager' ); ?></th>
598
- <th scope="col" title="<?php esc_attr_e( 'Remove button', 'woocommerce-checkout-manager' ); ?>"><!-- remove --></th>
599
- </tr>
600
- </thead>
601
- <tbody>
602
-
603
-
604
- <?php
605
- if ( isset ( $options['buttons'] ) ) :
606
-
607
- // Loop through all the buttons
608
- for ( $i = 0; $i < count( $options['buttons'] ); $i++ ) :
609
-
610
- if ( ! isset( $options['buttons'][$i] ) )
611
- break;
612
-
613
-
614
- ?>
615
-
616
-
617
-
618
- <tr valign="top" class="wccs-row">
619
- <td class="wccs-order" title="<?php esc_attr_e( 'Change order', 'woocommerce-checkout-manager' ); ?>"><?php echo $i + 1; ?></td>
620
-
621
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
622
-
623
-
624
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][label]"
625
- value="<?php echo esc_attr( $options['buttons'][$i][label] ); ?>" /></td>
626
-
627
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][placeholder]"
628
- value="<?php echo esc_attr( $options['buttons'][$i][placeholder] ); ?>" /></td>
629
-
630
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_a]"
631
- value="<?php echo esc_attr( $options['buttons'][$i][option_a] ); ?>" /></td>
632
-
633
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_b]"
634
- value="<?php echo esc_attr( $options['buttons'][$i][option_b] ); ?>" /></td>
635
-
636
-
637
- <td>
638
- <select name="wccs_settings[buttons][<?php echo $i; ?>][type]" > <!--Call run() function-->
639
- <option value="text" <?php selected( $options['buttons'][$i][type], 'text' ); ?>>Text Input</option>
640
- <option value="select" <?php selected( $options['buttons'][$i][type], 'select' ); ?>>Select Options</option>
641
- <option value="date" <?php selected( $options['buttons'][$i][type], 'date' ); ?>>Date Picker</option>
642
- <option value="checkbox" <?php selected( $options['buttons'][$i][type], 'checkbox' ); ?>>Checkbox (1, 0)</option>
643
- </select>
644
- </td>
645
-
646
-
647
-
648
-
649
- <td><input type="text" maxlength="10" name="wccs_settings[buttons][<?php echo $i; ?>][cow]"
650
- value="<?php echo esc_attr( $options['buttons'][$i][cow] ); ?>" /></td>
651
-
652
-
653
- <td><input name="wccs_settings[buttons][<?php echo $i; ?>][checkbox]" type="checkbox" value="true" <?php if ( true == ($options['buttons'][$i][checkbox])) echo "checked='checked'"; ?> /></td>
654
-
655
-
656
- <td class="wccs-remove"><a class="wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Remove Field' , 'woocommerce-checkout-manager' ); ?>">&times;</a></td>
657
- </tr>
658
-
659
- <?php endfor; endif; ?>
660
- <!-- Empty -->
661
-
662
- <?php $i = 999; ?>
663
-
664
- <tr valign="top" class="wccs-clone" >
665
-
666
- <td class="wccs-order" title="<?php esc_attr_e( 'Change order' , 'woocommerce-checkout-manager' ); ?>"><?php echo $i; ?></td>
667
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
668
-
669
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][label]"
670
- title="<?php esc_attr_e( 'Label of the New Field', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
671
-
672
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][placeholder]"
673
- title="<?php esc_attr_e( 'Placeholder - Preview of Data to Input', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
674
-
675
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_a]"
676
- title="<?php esc_attr_e( 'Insert Option A', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
677
-
678
- <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_b]"
679
- title="<?php esc_attr_e( 'Insert Option B', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
680
-
681
- <td>
682
- <select name="wccs_settings[buttons][<?php echo $i; ?>][type]" > <!--Call run() function-->
683
- <option value="text" >Text Input</option>
684
- <option value="select" >Select Options</option>
685
- <option value="date" >Date Picker</option>
686
- <option value="checkbox" >Checkbox (1, 0)</option>
687
- </select>
688
- </td>
689
-
690
-
691
- <td><input type="text" maxlength="5" name="wccs_settings[buttons][<?php echo $i; ?>][cow]"
692
- title="<?php esc_attr_e( 'Abbreviation (No spaces)', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
693
-
694
- <td><input name="wccs_settings[buttons][<?php echo $i; ?>][checkbox]" type="checkbox"
695
- title="<?php esc_attr_e( 'Add/Remove Required Attribute', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
696
-
697
-
698
- <td class="wccs-remove"><a class="wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Remove Field' , 'woocommerce-checkout-manager' ); ?>">&times;</a></td>
699
-
700
- </tr>
701
- </tbody>
702
-
703
- </table>
704
-
705
- <div class="wccs-table-footer">
706
- <a href="javascript:;" id="wccs-add-button" class="button-secondary"><?php _e( '+ Add New Field' , 'woocommerce-checkout-manager' ); ?></a>
707
- </div>
708
-
709
- </form>
710
- <?php
711
- }
712
-
713
-
714
-
715
- // Build array of links for rendering in installed plugins list
716
- function wccs_admin_plugin_actions($links) {
717
-
718
- $wccs_plugin_links = array(
719
- '<a href="options-general.php?page=woocommerce-checkout-manager/woocommerce-checkout-manager.php">'.__('Settings').'</a>',
720
- '<a href="http://www.trottyzone.com/forums/forum/website-support/">'.__('Support').'</a>',
721
- );
722
-
723
- return array_merge( $wccs_plugin_links, $links );
724
-
725
- }
726
-
727
-
728
- function wccs_scripts( $hook_suffix ) {
729
- if ( $hook_suffix == 'settings_page_woocommerce-checkout-manager/woocommerce-checkout-manager' ) {
730
-
731
- wp_enqueue_script( 'script_wccs', plugins_url( 'script_wccs.js', __FILE__ ), array( 'jquery' ), '1.2' );
732
- if(!wp_script_is('jquery-ui-sortable', 'queue')){
733
- wp_enqueue_script('jquery-ui-sortable');
734
- }
735
- }
736
- }
737
-
738
- add_action( 'admin_enqueue_scripts', 'wccs_scripts' );
739
-
740
-
741
-
742
- // ================== First Name ===================
743
- function wccs_override_checkout_fields1($fields1) {
744
- $options = get_option( 'wccs_settings' );
745
- if ( 1 == ($options['checkness']['wccs_opt_1'] ) )
746
- unset($fields1['billing']['billing_first_name']);
747
- return $fields1;
748
- }
749
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields1' );
750
-
751
- function wccs_override_required_fields1( $address_fields1 ) {
752
- $options = get_option( 'wccs_settings' );
753
- if ( 1 == ($options['checkness']['wccs_rq_1'] ) )
754
- $address_fields1['billing_first_name']['required'] = false;
755
- return $address_fields1;
756
- }
757
- add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields1', 10, 1 );
758
-
759
- // replace label and placeholder
760
- function custom_replace_checkout_fields( $fields ) {
761
- $options = get_option( 'wccs_settings' );
762
- if ( ! empty( $options['replace']['placeholder'] ) )
763
- $fields['billing']['billing_first_name']['placeholder'] = ''.$options['replace']['placeholder'].'';
764
- return $fields;
765
- }
766
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields' );
767
-
768
-
769
- function custom_replace_checkout_fieldsa( $fields ) {
770
- $options = get_option( 'wccs_settings' );
771
- if ( ! empty( $options['replace']['label'] ) )
772
- $fields['billing']['billing_first_name']['label'] = ''.$options['replace']['label'].'';
773
- return $fields;
774
- }
775
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsa' );
776
-
777
-
778
- // ========== Last Name ==============
779
- function wccs_override_checkout_fields2($fields2) {
780
- $options = get_option( 'wccs_settings' );
781
- if ( 1 == ($options['checkness']['wccs_opt_2'] ) )
782
- unset($fields2['billing']['billing_last_name']);
783
- return $fields2;
784
- }
785
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields2' );
786
-
787
- function wccs_override_required_fields2( $address_fields2 ) {
788
- $options = get_option( 'wccs_settings' );
789
- if ( 1 == ($options['checkness']['wccs_rq_2'] ) )
790
- $address_fields2['billing_last_name']['required'] = false;
791
- return $address_fields2;
792
- }
793
- add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields2', 10, 1 );
794
-
795
- // replace label and placeholder
796
- function custom_replace_checkout_fields1( $fields ) {
797
- $options = get_option( 'wccs_settings' );
798
- if ( ! empty( $options['replace']['placeholder1'] ) )
799
- $fields['billing']['billing_last_name']['placeholder'] = ''.$options['replace']['placeholder1'].'';
800
- return $fields;
801
- }
802
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields1' );
803
-
804
-
805
- function custom_replace_checkout_fieldsb( $fields ) {
806
- $options = get_option( 'wccs_settings' );
807
- if ( ! empty( $options['replace']['label1'] ) )
808
- $fields['billing']['billing_last_name']['label'] = ''.$options['replace']['label1'].'';
809
- return $fields;
810
- }
811
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsb' );
812
-
813
- // ============ Company ==============
814
- function wccs_override_checkout_fields3($fields3) {
815
- $options = get_option( 'wccs_settings' );
816
- if ( 1 == ($options['checkness']['wccs_opt_3'] ) )
817
- unset($fields3['billing']['billing_company']);
818
- return $fields3;
819
- }
820
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields3' );
821
-
822
- // replace label and placeholder
823
- function custom_replace_checkout_fields2( $fields ) {
824
- $options = get_option( 'wccs_settings' );
825
- if ( ! empty( $options['replace']['placeholder2'] ) )
826
- $fields['billing']['billing_company']['placeholder'] = ''.$options['replace']['placeholder2'].'';
827
- return $fields;
828
- }
829
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields2' );
830
-
831
-
832
- function custom_replace_checkout_fieldsc( $fields ) {
833
- $options = get_option( 'wccs_settings' );
834
- if ( ! empty( $options['replace']['label5'] ) )
835
- $fields['billing']['billing_company']['label'] = ''.$options['replace']['label5'].'';
836
- return $fields;
837
- }
838
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsc' );
839
-
840
- // ============ Address 1 ==============
841
- function wccs_override_checkout_fields4($fields4) {
842
- $options = get_option( 'wccs_settings' );
843
- if ( 1 == ($options['checkness']['wccs_opt_4'] ) )
844
- unset($fields4['billing']['billing_address_1']);
845
- return $fields4;
846
- }
847
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields4' );
848
-
849
-
850
- // ============ Address 2 ===============
851
- function wccs_override_checkout_fields5($fields5) {
852
- $options = get_option( 'wccs_settings' );
853
- if ( 1 == ($options['checkness']['wccs_opt_5'] ) )
854
- unset($fields5['billing']['billing_address_2']);
855
- return $fields5;
856
- }
857
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields5' );
858
-
859
-
860
- // ============= City ================
861
- function wccs_override_checkout_fields6($fields6) {
862
- $options = get_option( 'wccs_settings' );
863
- if ( 1 == ($options['checkness']['wccs_opt_6'] ) )
864
- unset($fields6['billing']['billing_city']);
865
- return $fields6;
866
- }
867
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields6' );
868
-
869
-
870
- // ============= Postal Code ================
871
- function wccs_override_checkout_fields7($fields7) {
872
- $options = get_option( 'wccs_settings' );
873
- if ( 1 == ($options['checkness']['wccs_opt_7'] ) )
874
- unset($fields7['billing']['billing_postcode']);
875
- return $fields7;
876
- }
877
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields7' );
878
-
879
-
880
- // =================== Country==================
881
- function wccs_override_checkout_fields8($fields8) {
882
- $options = get_option( 'wccs_settings' );
883
- if ( 1 == ($options['checkness']['wccs_opt_8'] ) )
884
- unset($fields8['billing']['billing_country']);
885
- return $fields8;
886
- }
887
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields8' );
888
-
889
- function wccs_override_required_fields8( $address_fields8 ) {
890
- $options = get_option( 'wccs_settings' );
891
- if ( 1 == ($options['checkness']['wccs_rq_8'] ) )
892
- $address_fields8['billing_country']['required'] = false;
893
- return $address_fields8;
894
- }
895
- add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields8', 10, 1 );
896
-
897
- function custom_replace_checkout_fieldsh( $fields ) {
898
- $options = get_option( 'wccs_settings' );
899
- if ( ! empty( $options['replace']['label2'] ) )
900
- $fields['billing']['billing_country']['label'] = ''.$options['replace']['label2'].'';
901
- return $fields;
902
- }
903
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsh' );
904
-
905
-
906
- // ================= State ===================
907
- function wccs_override_checkout_fields9($fields9) {
908
- $options = get_option( 'wccs_settings' );
909
- if ( 1 == ($options['checkness']['wccs_opt_9'] ) )
910
- unset($fields9['billing']['billing_state']);
911
- return $fields9;
912
- }
913
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields9' );
914
-
915
- // =============== Phone ======================
916
- function wccs_override_checkout_fields10($fields10) {
917
- $options = get_option( 'wccs_settings' );
918
- if ( 1 == ($options['checkness']['wccs_opt_10'] ) )
919
- unset($fields10['billing']['billing_phone']);
920
- return $fields10;
921
- }
922
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields10' );
923
-
924
- function wccs_override_required_fields10( $address_fields10 ) {
925
- $options = get_option( 'wccs_settings' );
926
- if ( 1 == ($options['checkness']['wccs_rq_10'] ) )
927
- $address_fields10['billing_phone']['required'] = false;
928
- return $address_fields10;
929
- }
930
- add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields10', 10, 1 );
931
-
932
- // replace label and placeholder
933
- function custom_replace_checkout_fields9( $fields ) {
934
- $options = get_option( 'wccs_settings' );
935
- if ( ! empty( $options['replace']['placeholder3'] ) )
936
- $fields['billing']['billing_phone']['placeholder'] = ''.$options['replace']['placeholder3'].'';
937
- return $fields;
938
- }
939
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields9' );
940
-
941
-
942
- function custom_replace_checkout_fieldsj( $fields ) {
943
- $options = get_option( 'wccs_settings' );
944
- if ( ! empty( $options['replace']['label3'] ) )
945
- $fields['billing']['billing_phone']['label'] = ''.$options['replace']['label3'].'';
946
- return $fields;
947
- }
948
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsj' );
949
-
950
-
951
- // ==================== Email ========================
952
- function wccs_override_checkout_fields11($fields11) {
953
- $options = get_option( 'wccs_settings' );
954
- if ( 1 == ($options['checkness']['wccs_opt_11'] ) )
955
- unset($fields11['billing']['billing_email']);
956
- return $fields11;
957
- }
958
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields11' );
959
-
960
- function wccs_override_required_fields11( $address_fields11 ) {
961
- $options = get_option( 'wccs_settings' );
962
- if ( 1 == ($options['checkness']['wccs_rq_11'] ) )
963
- $address_fields11['billing_email']['required'] = false;
964
- return $address_fields11;
965
- }
966
- add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields11', 10, 1 );
967
-
968
- // replace label and placeholder
969
- function custom_replace_checkout_fields10( $fields ) {
970
- $options = get_option( 'wccs_settings' );
971
- if ( ! empty( $options['replace']['placeholder4'] ) )
972
- $fields['billing']['billing_email']['placeholder'] = ''.$options['replace']['placeholder4'].'';
973
- return $fields;
974
- }
975
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields10' );
976
-
977
-
978
- function custom_replace_checkout_fieldsk( $fields ) {
979
- $options = get_option( 'wccs_settings' );
980
- if ( ! empty( $options['replace']['label4'] ) )
981
- $fields['billing']['billing_email']['label'] = ''.$options['replace']['label4'].'';
982
- return $fields;
983
- }
984
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsk' );
985
-
986
-
987
- // ===================== Order Comments ==========================
988
- function wccs_override_checkout_fields12($fields12) {
989
- $options = get_option( 'wccs_settings' );
990
- if ( 1 == ($options['checkness']['wccs_opt_12'] ) )
991
- unset($fields12['order']['order_comments']);
992
- return $fields12;
993
- }
994
- add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields12' );
995
-
996
- // replace label and placeholder
997
- function custom_replace_checkout_fields11( $fields ) {
998
- $options = get_option( 'wccs_settings' );
999
- if ( ! empty( $options['replace']['placeholder11'] ) )
1000
- $fields['order']['order_comments']['placeholder'] = ''.$options['replace']['placeholder11'].'';
1001
- return $fields;
1002
- }
1003
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields11' );
1004
-
1005
-
1006
- function custom_replace_checkout_fieldsl( $fields ) {
1007
- $options = get_option( 'wccs_settings' );
1008
- if ( ! empty( $options['replace']['label11'] ) )
1009
- $fields['order']['order_comments']['label'] = ''.$options['replace']['label11'].'';
1010
- return $fields;
1011
- }
1012
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsl' );
1013
-
1014
- function wccs_add_title() {
1015
- $options = get_option( 'wccs_settings' );
1016
- if (true == ($options['checkness']['checkbox12']) )
1017
- echo '<div class="add_info_wccs"><br><h3>' . __( 'Additional information', 'woocommerce-checkout-manager' ) . '</h3></div>';
1018
- }
1019
- add_action('woocommerce_after_checkout_billing_form', 'wccs_add_title');
1020
-
1021
- // =============== Add the field to the checkout =====================
1022
- function wccs_custom_checkout_field( $checkout ) {
1023
-
1024
- $options = get_option( 'wccs_settings' );
1025
-
1026
- if ( count( $options['buttons'] ) > 0 ) : ?>
1027
-
1028
- <?php
1029
- $i = 0;
1030
-
1031
- // Loop through each button
1032
- foreach ( $options['buttons'] as $btn ) :
1033
-
1034
- $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
1035
-
1036
- ?>
1037
- <?php
1038
-
1039
- if ( ! empty( $btn['label'] ) && ($btn['type'] == 'text') ) {
1040
-
1041
- woocommerce_form_field( ''.$btn['cow'].'' , array(
1042
- 'type' => 'text',
1043
- 'class' => array('wccs-field-class wccs-form-row-wide'),
1044
- 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
1045
- 'required' => $btn['checkbox'],
1046
- 'placeholder' => ''.$btn['placeholder'].'',
1047
-
1048
- ), $checkout->get_value( ''.$btn['cow'].'' ));
1049
-
1050
- }
1051
-
1052
-
1053
- if ( ! empty( $btn['label'] ) && ($btn['type'] == 'select') ) {
1054
-
1055
- woocommerce_form_field( ''.$btn['cow'].'' , array(
1056
- 'type' => 'select',
1057
- 'class' => array('wccs-field-class wccs-form-row-wide'),
1058
- 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
1059
- 'options' => array(
1060
- '' => __('Select below', 'woocommerce-checkout-manager' ),
1061
- ''.$btn['option_a'].'' => __(''.$btn['option_a'].'', 'woocommerce-checkout-manager' ),
1062
- ''.$btn['option_b'].'' => __(''.$btn['option_b'].'', 'woocommerce-checkout-manager' )
1063
- ),
1064
- 'required' => $btn['checkbox'],
1065
- 'placeholder' => ''.$btn['placeholder'].'',
1066
-
1067
- ), $checkout->get_value( ''.$btn['cow'].'' ));
1068
- }
1069
-
1070
- if ( ! empty( $btn['label'] ) && ($btn['type'] == 'date') ) {
1071
-
1072
- echo '<script type="text/javascript">
1073
-
1074
- jQuery(document).ready(function() {
1075
- jQuery(".MyDate-'.$btn['cow'].' #'.$btn['cow'].'").datepicker({
1076
- dateFormat : "dd-mm-yy"
1077
- });
1078
- });
1079
-
1080
- </script>';
1081
-
1082
- woocommerce_form_field( ''.$btn['cow'].'' , array(
1083
- 'type' => 'text',
1084
- 'class' => array('wccs-field-class MyDate-'.$btn['cow'].' wccs-form-row-wide'),
1085
- 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
1086
- 'required' => $btn['checkbox'],
1087
- 'placeholder' => ''.$btn['placeholder'].'',
1088
-
1089
- ), $checkout->get_value( ''.$btn['cow'].'' ));
1090
-
1091
- }
1092
-
1093
- if ( ! empty( $btn['label'] ) && ($btn['type'] == 'checkbox') ) {
1094
- woocommerce_form_field( ''.$btn['cow'].'' , array(
1095
- 'type' => 'checkbox',
1096
- 'class' => array('wccs-field-class wccs-form-row-wide'),
1097
- 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
1098
- 'required' => $btn['checkbox'],
1099
- 'placeholder' => ''.$btn['placeholder'].'',
1100
-
1101
- ), $checkout->get_value( ''.$btn['cow'].'' ));
1102
- }
1103
-
1104
- ?>
1105
- <?php
1106
- $i++;
1107
- endforeach;
1108
- ?>
1109
- <?php
1110
- endif;
1111
-
1112
- }
1113
-
1114
- add_action('woocommerce_after_checkout_billing_form', 'wccs_custom_checkout_field');
1115
-
1116
-
1117
- // ============================== Update the order meta with field value ==============================
1118
- function wccs_custom_checkout_field_update_order_meta( $order_id ) {
1119
-
1120
- $options = get_option( 'wccs_settings' );
1121
- if ( count( $options['buttons'] ) > 0 ) :
1122
- $i = 0;
1123
-
1124
- // Loop through each button
1125
- foreach ( $options['buttons'] as $btn ) :
1126
-
1127
- $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
1128
- if ( ! empty( $btn['label'] ) )
1129
- if ( $_POST[ ''.$btn['cow'].'' ])
1130
- update_post_meta( $order_id, ''.$btn['label'].'' , esc_attr( $_POST[ ''.$btn['cow'].'' ] ));
1131
- $i++;
1132
- endforeach;
1133
- endif;
1134
- }
1135
- add_action('woocommerce_checkout_update_order_meta', 'wccs_custom_checkout_field_update_order_meta');
1136
-
1137
- // =============== Add to email (working) =====================
1138
- add_filter('woocommerce_email_order_meta_keys', 'wccs_custom_checkout_field_order_meta_keys');
1139
-
1140
- function wccs_custom_checkout_field_order_meta_keys( $keys ) {
1141
- $options = get_option( 'wccs_settings' );
1142
- if ( count( $options['buttons'] ) > 0 ) :
1143
- $i = 0;
1144
- // Loop through each button
1145
- foreach ( $options['buttons'] as $btn ) :
1146
-
1147
- $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
1148
- if ( ! empty( $btn['label'] ) )
1149
- $keys[] = ''.$btn['label'].'';
1150
- $i++;
1151
- endforeach;
1152
- return $keys;
1153
- endif;
1154
- }
1155
- // ================ Style the Email =======================
1156
- add_action('woocommerce_email_after_order_table', 'wccs_custom_style_checkout_email');
1157
- function wccs_custom_style_checkout_email() {
1158
- $options = get_option( 'wccs_settings' );
1159
- if (true == ($options['checkness']['checkbox1']) )
1160
- echo '<h2>' . __( 'Additional information', 'woocommerce-checkout-manager' ) . '</h2>';
1161
- }
1162
-
1163
- // ============== Process the checkout (if needed activate) ==================
1164
- function wccs_custom_checkout_field_process() {
1165
- $options = get_option( 'wccs_settings' );
1166
-
1167
- if ( count( $options['buttons'] ) > 0 ) :
1168
- $i = 0;
1169
-
1170
- // Loop through each button
1171
- foreach ( $options['buttons'] as $btn ) :
1172
-
1173
- $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
1174
- global $woocommerce;
1175
-
1176
- if ( (!$_POST[ ''.$btn['cow'].'' ] ) && (true == ($btn['checkbox']) ) )
1177
-
1178
-
1179
- $woocommerce->add_error( '<strong>'.$btn['label'].'</strong> '. __('is a required field', 'woocommerce-checkout-manager' ) . ' ');
1180
-
1181
-
1182
-
1183
- $i++;
1184
- endforeach;
1185
-
1186
-
1187
- endif;
1188
- }
1189
- add_action('woocommerce_checkout_process', 'wccs_custom_checkout_field_process');
1190
-
1191
- function wccs_options_validatew() {
1192
- $options = get_option( 'wccs_settings' );
1193
- if ( empty( $options['replace']['label'] ) )
1194
- unset( $options['replace']['label'] );
1195
- }
1196
-
1197
-
1198
- function wccs_options_validate( $input ) {
1199
-
1200
- $options = get_option( 'wccs_settings' );
1201
-
1202
-
1203
- // Don't save empty inputs
1204
- foreach( $input['buttons'] as $i => $btn ) :
1205
-
1206
- if ( empty( $btn['label'] ) )
1207
- unset( $input['buttons'][$i], $btn );
1208
-
1209
- endforeach;
1210
-
1211
- $input['buttons'] = array_values( $input['buttons'] );
1212
-
1213
- return $input;
1214
-
1215
- }
1216
- function wccs_custom_checkout_details( $order_id ) {
1217
- $options = get_option( 'wccs_settings' );
1218
-
1219
- if (true == ($options['checkness']['checkbox1']) ) {
1220
- echo '<h2>' . __( 'Additional information', 'woocommerce-checkout-manager' ) . '</h2>';
1221
- }
1222
-
1223
- if ( count( $options['buttons'] ) > 0 ) :
1224
- $i = 0;
1225
- // Loop through each button
1226
- foreach ( $options['buttons'] as $btn ) :
1227
- $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
1228
- $order_object = new WC_Order( $order_id );
1229
- echo '<dt>'.$btn['label'].':</dt><dd>'.get_post_meta( $order_id->id , ''.$btn['label'].'', true).'</dd>';
1230
- $i++;
1231
- endforeach;
1232
- endif;
1233
- }
1234
- add_action('woocommerce_order_details_after_order_table', 'wccs_custom_checkout_details');
1235
-
1236
-
1237
-
1238
-
1239
-
1240
- // ================== First Name ===================
1241
- function wccs_shipping_checkout_fields1( $fields1 ) {
1242
- $options = get_option( 'wccs_settings' );
1243
- if ( 1 == ($options['check']['wccs_opt_1_s'] ) )
1244
- unset($fields1['shipping']['shipping_first_name']);
1245
- return $fields1;
1246
- }
1247
- add_filter( 'woocommerce_checkout_fields' , 'wccs_shipping_checkout_fields1' );
1248
-
1249
- function wccs_shipping_required_fields1( $address_fields1 ) {
1250
- $options = get_option( 'wccs_settings' );
1251
- if ( 1 == ($options['check']['wccs_rq_1_s'] ) )
1252
- $address_fields1['shipping_first_name']['required'] = false;
1253
- return $address_fields1;
1254
- }
1255
- add_filter( 'woocommerce_shipping_fields', 'wccs_shipping_required_fields1', 10, 1 );
1256
-
1257
- // replace label and placeholder
1258
- function custom_replace_checkout_fieldss( $fields ) {
1259
- $options = get_option( 'wccs_settings' );
1260
- if ( ! empty( $options['replace']['placeholder_s'] ) )
1261
- $fields['shipping']['shipping_first_name']['placeholder'] = ''.$options['replace']['placeholder_s'].'';
1262
- return $fields;
1263
- }
1264
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldss' );
1265
-
1266
-
1267
- function custom_replace_checkout_fieldssa( $fields ) {
1268
- $options = get_option( 'wccs_settings' );
1269
- if ( ! empty( $options['replace']['label_s'] ) )
1270
- $fields['shipping']['shipping_first_name']['label'] = ''.$options['replace']['label_s'].'';
1271
- return $fields;
1272
- }
1273
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssa' );
1274
-
1275
-
1276
- // ========== Last Name ==============
1277
- function wccs_shipping_checkout_fields2( $fields2 ) {
1278
- $options = get_option( 'wccs_settings' );
1279
- if ( 1 == ($options['check']['wccs_opt_2_s'] ) )
1280
- unset($fields2['shipping']['shipping_last_name']);
1281
- return $fields2;
1282
- }
1283
- add_filter( 'woocommerce_checkout_fields' , 'wccs_shipping_checkout_fields2' );
1284
-
1285
- function wccs_shipping_required_fields2( $address_fields2 ) {
1286
- $options = get_option( 'wccs_settings' );
1287
- if ( 1 == ($options['check']['wccs_rq_2_s'] ) )
1288
- $address_fields2['shipping_last_name']['required'] = false;
1289
- return $address_fields2;
1290
- }
1291
- add_filter( 'woocommerce_shipping_fields', 'wccs_shipping_required_fields2', 10, 1 );
1292
-
1293
- // replace label and placeholder
1294
- function custom_replace_checkout_fieldss1( $fields ) {
1295
- $options = get_option( 'wccs_settings' );
1296
- if ( ! empty( $options['replace']['placeholder_s1'] ) )
1297
- $fields['shipping']['shipping_last_name']['placeholder'] = ''.$options['replace']['placeholder_s1'].'';
1298
- return $fields;
1299
- }
1300
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldss1' );
1301
-
1302
-
1303
- function custom_replace_checkout_fieldssb( $fields ) {
1304
- $options = get_option( 'wccs_settings' );
1305
- if ( ! empty( $options['replace']['label_s1'] ) )
1306
- $fields['shipping']['shipping_last_name']['label'] = ''.$options['replace']['label_s1'].'';
1307
- return $fields;
1308
- }
1309
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssb' );
1310
-
1311
-
1312
- // ============ Company ==============
1313
- function wccs_shipping_checkout_fields3( $fields3 ) {
1314
- $options = get_option( 'wccs_settings' );
1315
- if ( 1 == ($options['check']['wccs_opt_3_s'] ) )
1316
- unset($fields3['shipping']['shipping_company']);
1317
- return $fields3;
1318
- }
1319
- add_filter( 'woocommerce_checkout_fields' , 'wccs_shipping_checkout_fields3' );
1320
-
1321
- // replace label and placeholder
1322
- function custom_replace_checkout_fieldss2( $fields ) {
1323
- $options = get_option( 'wccs_settings' );
1324
- if ( ! empty( $options['replace']['placeholder_s2'] ) )
1325
- $fields['shipping']['shipping_company']['placeholder'] = ''.$options['replace']['placeholder_s2'].'';
1326
- return $fields;
1327
- }
1328
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldss2' );
1329
-
1330
-
1331
- function custom_replace_checkout_fieldssc( $fields ) {
1332
- $options = get_option( 'wccs_settings' );
1333
- if ( ! empty( $options['replace']['label_s2'] ) )
1334
- $fields['shipping']['shipping_company']['label'] = ''.$options['replace']['label_s2'].'';
1335
- return $fields;
1336
- }
1337
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssc' );
1338
-
1339
- // Hook in
1340
- add_filter( 'woocommerce_checkout_fields' , 'b1_custom_override_checkout_fields' );
1341
-
1342
- // Our hooked in function - $fields is passed via the filter!
1343
- function b1_custom_override_checkout_fields( $fields ) {
1344
- $options = get_option( 'wccs_settings' );
1345
- if ( 1 == ($options['check']['wccs_opt_4_s'] ) )
1346
- unset($fields['shipping']['shipping_address_1']);
1347
-
1348
- return $fields;
1349
- }
1350
- // Hook in
1351
- add_filter( 'woocommerce_checkout_fields' , 'b2_custom_override_checkout_fields' );
1352
-
1353
- // Our hooked in function - $fields is passed via the filter!
1354
- function b2_custom_override_checkout_fields( $fields ) {
1355
- $options = get_option( 'wccs_settings' );
1356
- if ( 1 == ($options['check']['wccs_opt_5_s'] ) )
1357
- unset($fields['shipping']['shipping_address_2']);
1358
-
1359
- return $fields;
1360
- }
1361
-
1362
- // Hook in
1363
- add_filter( 'woocommerce_checkout_fields' , 'c_custom_override_checkout_fields' );
1364
-
1365
- // Our hooked in function - $fields is passed via the filter!
1366
- function c_custom_override_checkout_fields( $fields ) {
1367
- $options = get_option( 'wccs_settings' );
1368
- if ( 1 == ($options['check']['wccs_opt_6_s'] ) )
1369
- unset($fields['shipping']['shipping_city']);
1370
-
1371
- return $fields;
1372
- }
1373
-
1374
- // Hook in
1375
- add_filter( 'woocommerce_checkout_fields' , 'sp_custom_override_checkout_fields' );
1376
-
1377
- // Our hooked in function - $fields is passed via the filter!
1378
- function sp_custom_override_checkout_fields( $fields ) {
1379
- $options = get_option( 'wccs_settings' );
1380
- if ( 1 == ($options['check']['wccs_opt_7_s'] ) )
1381
- unset($fields['shipping']['shipping_postcode']);
1382
-
1383
- return $fields;
1384
- }
1385
-
1386
-
1387
- // =================== Shipping Country ======================
1388
- // Hook in
1389
- add_filter( 'woocommerce_checkout_fields' , 'sc_custom_override_checkout_fields' );
1390
-
1391
- // Our hooked in function - $fields is passed via the filter!
1392
- function sc_custom_override_checkout_fields( $fields ) {
1393
- $options = get_option( 'wccs_settings' );
1394
- if ( 1 == ($options['check']['wccs_opt_8_s'] ) )
1395
- unset($fields['shipping']['shipping_country']);
1396
-
1397
- return $fields;
1398
- }
1399
-
1400
- // replace label and placeholder
1401
- function custom_replace_checkout_fieldssd( $fields ) {
1402
- $options = get_option( 'wccs_settings' );
1403
- if ( ! empty( $options['replace']['label_s7'] ) )
1404
- $fields['shipping']['shipping_country']['label'] = ''.$options['replace']['label_s7'].'';
1405
- return $fields;
1406
- }
1407
- add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssd' );
1408
-
1409
-
1410
- // Hook in
1411
- add_filter( 'woocommerce_checkout_fields' , 'ss_custom_override_checkout_fields' );
1412
-
1413
- // Our hooked in function - $fields is passed via the filter!
1414
- function ss_custom_override_checkout_fields( $fields ) {
1415
- $options = get_option( 'wccs_settings' );
1416
- if ( 1 == ($options['check']['wccs_opt_9_s'] ) )
1417
- unset($fields['shipping']['shipping_state']);
1418
-
1419
- return $fields;
1420
- }
1421
-
1422
- function display_front_wccs() {
1423
- echo '<style type="text/css">
1424
- .wccs-field-class {
1425
- float:left;
1426
- width: 47%;
1427
- }
1428
- .wccs-field-class:nth-child(2n+2) {
1429
- float: right;
1430
- }
1431
- .add_info_wccs {
1432
- clear: both;
1433
- }
1434
- </style>';
1435
- }
1436
  add_action('wp_head','display_front_wccs');
1
+ <?php
2
+ /*
3
+ Plugin Name: WooCommerce Checkout Manager
4
+ Plugin URI: http://www.trottyzone.com/product/woocommerce-checkout-manager-pro
5
+ Description: Manages WooCommerce Checkout fields
6
+ Version: 3.5.9
7
+ Author: Ephrain Marchan
8
+ Author URI: http://www.trottyzone.com
9
+ License: GPLv2 or later
10
+ */
11
+ /*
12
+ This program is free software; you can redistribute it and/or
13
+ modify it under the terms of the GNU General Public License
14
+ as published by the Free Software Foundation; either version 2
15
+ of the License, or (at your option) any later version.
16
+ This program is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ GNU General Public License for more details.
20
+ You should have received a copy of the GNU General Public License
21
+ along with this program; if not, write to the Free Software
22
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
+ */
24
+ if ( ! defined( 'ABSPATH' ) ) die();
25
+ register_activation_hook( __FILE__, 'wccs_install' );
26
+ load_plugin_textdomain('woocommerce-checkout-manager', false, dirname(plugin_basename(__FILE__)) . '/languages/');
27
+ function wccs_install() {
28
+ $defaults = array( 'buttons' => array( array(
29
+ 'label' => __( 'Example Label', 'woocommerce-checkout-manager' ),
30
+ 'placeholder' => __( 'Example placeholder', 'woocommerce-checkout-manager' ),
31
+ 'cow' => __('myfld1', 'woocommerce-checkout-manager'),
32
+ 'option_a' => __('option 1', 'woocommerce-checkout-manager'),
33
+ 'option_b' => __('option 2', 'woocommerce-checkout-manager')
34
+ )
35
+ ),
36
+ 'checkness' => array(
37
+ 'checkbox1' => true,
38
+ 'checkbox12' => true
39
+ )
40
+ );
41
+ add_option( 'wccs_settings', apply_filters( 'wccs_defaults', $defaults ) );
42
+ }
43
+ // Hook for adding admin menus
44
+ if ( is_admin() ){ // admin actions
45
+ // Hook for adding admin menu
46
+ add_action( 'admin_menu', 'wccs_admin_menu' );
47
+ // Display the 'Settings' link in the plugin row on the installed plugins list page
48
+ add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'wccs_admin_plugin_actions', -10);
49
+ add_action( 'admin_init', 'wccs_register_setting' );
50
+ } else { // non-admin enqueues, actions, and filters
51
+ // hook to get option values and dynamically render css to support the tab classes
52
+ wp_enqueue_script('jquery-ui-datepicker');
53
+ wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
54
+ }
55
+ // action function for above hook
56
+ function wccs_admin_menu() {
57
+ // Add a new submenu under Settings:
58
+ add_options_page( __('WooCommerce Checkout Manager', 'woocommerce-checkout-manager'), __('WooCommerce Checkout Manager', 'woocommerce-checkout-manager'), 'manage_options', __FILE__ , 'wccs__options_page');
59
+ }
60
+ function wccs_register_setting() {
61
+ register_setting( 'wccs_options', 'wccs_settings', 'wccs_options_validate' );
62
+ }
63
+ // fc_settings_page() displays the page content
64
+ function wccs__options_page() {
65
+ //must check that the user has the required capability
66
+ if (!current_user_can('manage_options'))
67
+ {
68
+ wp_die( __('You do not have sufficient permissions to access this page.') );
69
+ }
70
+ // variables for the field and option names
71
+ $hidden_field_name = 'mccs_submit_hidden';
72
+ // read options values
73
+ $options = get_option( 'wccs_settings' );
74
+ if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
75
+ // Save the posted value in the database
76
+ update_option( 'wccs_settings', $options );
77
+ ?>
78
+ <div class="updated"><p><strong><?php _e('settings saved.'); ?></strong></p></div>
79
+ <?php
80
+ }
81
+ // Now display the settings editing screen
82
+ echo '<div class="wrap">';
83
+ // icon for settings
84
+ echo '<div id="icon-themes" class="icon32"><br></div>';
85
+ // header
86
+ echo "<h2>" . __( 'WooCommerce Checkout Manager', 'woocommerce-checkout-manager' ) . "</h2>";
87
+ // settings form
88
+ ?>
89
+ <div style="padding:5px 10px;float:right;font-weight:700;color:green;" class="updated">
90
+ <?php _e('Found this Plugin Useful? Why not Buy me a ', 'woocommerce-checkout-manager'); ?><a href="http://www.trottyzone.com/donation/"><?php _e('beer', 'woocommerce-checkout-manager'); ?></a> <?php _e('to say thanks for the awesome coding.', 'woocommerce-checkout-manager'); ?>
91
+ </div>
92
+ <form name="form" method="post" action="options.php" id="frm1">
93
+ <?php
94
+ settings_fields( 'wccs_options' );
95
+ $options = get_option( 'wccs_settings' );
96
+ ?>
97
+ <table class="widefat" border="1" >
98
+ <thead>
99
+ <tr>
100
+ <th><?php _e('Field Name', 'woocommerce-checkout-manager'); ?></th>
101
+ <th><?php _e('Remove Field Entirely', 'woocommerce-checkout-manager'); ?></th>
102
+ <th><?php _e('Remove Required Attribute', 'woocommerce-checkout-manager'); ?></th>
103
+ <th class="wccs_replace"><?php _e('Replace Label Name', 'woocommerce-checkout-manager'); ?></th>
104
+ <th class="wccs_replace"><?php _e('Replace Placeholder Name', 'woocommerce-checkout-manager'); ?></th>
105
+ </tr>
106
+ </thead>
107
+ <tbody>
108
+ <tr>
109
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
110
+ <td><strong><?php _e('Select All Check boxes in this Column', 'woocommerce-checkout-manager'); ?></strong></td>
111
+ <td><input name="wccs_settings[checkness][select_all_rm]" type="checkbox" id="select_all_rm" value="1" <?php if ( 1 == ($options['checkness']['select_all_rm'])) echo "checked='checked'"; ?> /></td>
112
+ <td><input name="wccs_settings[checkness][select_all_rq]" type="checkbox" id="select_all_rq" value="1" <?php if ( 1 == ($options['checkness']['select_all_rq'])) echo "checked='checked'"; ?> /></td>
113
+ <td></td>
114
+ <td></td>
115
+ </tr>
116
+ </tbody>
117
+ <tbody>
118
+ <tr>
119
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
120
+ <td><?php _e('First Name', 'woocommerce-checkout-manager'); ?></td>
121
+ <td><input name="wccs_settings[checkness][wccs_opt_1]" type="checkbox" class="rm" value="1"
122
+ <?php if ( 1 == ($options['checkness']['wccs_opt_1']) ) echo 'checked="checked"'; ?> /></td>
123
+ <td><input name="wccs_settings[checkness][wccs_rq_1]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_1'])) echo "checked='checked'"; ?> /></td>
124
+ <td><input type="text" name="wccs_settings[replace][label]"
125
+ value="<?php echo esc_attr( $options['replace']['label'] ); ?>" /></td>
126
+ <td><input type="text" name="wccs_settings[replace][placeholder]"
127
+ value="<?php echo esc_attr( $options['replace']['placeholder'] ); ?>" /></td>
128
+ </tr>
129
+ </tbody>
130
+ <tbody>
131
+ <tr>
132
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
133
+ <td><?php _e('Last Name', 'woocommerce-checkout-manager'); ?></td>
134
+ <td><input name="wccs_settings[checkness][wccs_opt_2]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_2'])) echo "checked='checked'"; ?> /></td>
135
+ <td><input name="wccs_settings[checkness][wccs_rq_2]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_2'])) echo "checked='checked'"; ?> /></td>
136
+ <td><input type="text" name="wccs_settings[replace][label1]"
137
+ value="<?php echo esc_attr( $options['replace']['label1'] ); ?>" /></td>
138
+ <td><input type="text" name="wccs_settings[replace][placeholder1]"
139
+ value="<?php echo esc_attr( $options['replace']['placeholder1'] ); ?>" /></td>
140
+ </tr>
141
+ </tbody>
142
+ <tbody>
143
+ <tr>
144
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
145
+ <td><?php _e('Country', 'woocommerce-checkout-manager'); ?></td>
146
+ <td><input name="wccs_settings[checkness][wccs_opt_8]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_8'])) echo "checked='checked'"; ?> /></td>
147
+ <td><input name="wccs_settings[checkness][wccs_rq_8]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_8'])) echo "checked='checked'"; ?> /></td>
148
+ <td><input type="text" name="wccs_settings[replace][label2]"
149
+ value="<?php echo esc_attr( $options['replace']['label2'] ); ?>" /></td>
150
+ <td></td>
151
+ </tr>
152
+ </tbody>
153
+ <tbody>
154
+ <tr>
155
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
156
+ <td><?php _e('Phone', 'woocommerce-checkout-manager'); ?></td>
157
+ <td><input name="wccs_settings[checkness][wccs_opt_10]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_10'])) echo "checked='checked'"; ?> /></td>
158
+ <td><input name="wccs_settings[checkness][wccs_rq_10]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_10'])) echo "checked='checked'"; ?> /></td>
159
+ <td><input type="text" name="wccs_settings[replace][label3]"
160
+ value="<?php echo esc_attr( $options['replace']['label3'] ); ?>" /></td>
161
+ <td><input type="text" name="wccs_settings[replace][placeholder3]"
162
+ value="<?php echo esc_attr( $options['replace']['placeholder3'] ); ?>" /></td>
163
+ </tr>
164
+ </tbody>
165
+ <tbody>
166
+ <tr>
167
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
168
+ <td><?php _e('Email', 'woocommerce-checkout-manager'); ?></td>
169
+ <td><input name="wccs_settings[checkness][wccs_opt_11]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_11'])) echo "checked='checked'"; ?> /></td>
170
+ <td><input name="wccs_settings[checkness][wccs_rq_11]" type="checkbox" class="rq" value="1" <?php if ( 1 == ($options['checkness']['wccs_rq_11'])) echo "checked='checked'"; ?> /></td>
171
+ <td><input type="text" name="wccs_settings[replace][label4]"
172
+ value="<?php echo esc_attr( $options['replace']['label4'] ); ?>" /></td>
173
+ <td><input type="text" name="wccs_settings[replace][placeholder4]"
174
+ value="<?php echo esc_attr( $options['replace']['placeholder4'] ); ?>" /></td>
175
+ </tr>
176
+ </tbody>
177
+ <tbody>
178
+ <tr>
179
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
180
+ <td><?php _e('Company', 'woocommerce-checkout-manager'); ?></td>
181
+ <td><input name="wccs_settings[checkness][wccs_opt_3]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_3'])) echo "checked='checked'"; ?> /></td>
182
+ <td></td>
183
+ <td><input type="text" name="wccs_settings[replace][label5]"
184
+ value="<?php echo esc_attr( $options['replace']['label5'] ); ?>" /></td>
185
+ <td><input type="text" name="wccs_settings[replace][placeholder5]"
186
+ value="<?php echo esc_attr( $options['replace']['placeholder5'] ); ?>" /></td>
187
+ </tr>
188
+ </tbody>
189
+ <tbody>
190
+ <tr>
191
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
192
+ <td><?php _e('Order Comments', 'woocommerce-checkout-manager'); ?></td>
193
+ <td><input name="wccs_settings[checkness][wccs_opt_12]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_12'])) echo "checked='checked'"; ?> /></td>
194
+ <td></td>
195
+ <td><input type="text" name="wccs_settings[replace][label11]"
196
+ value="<?php echo esc_attr( $options['replace']['label11'] ); ?>" /></td>
197
+ <td><input type="text" name="wccs_settings[replace][placeholder11]"
198
+ value="<?php echo esc_attr( $options['replace']['placeholder11'] ); ?>" /></td>
199
+ </tr>
200
+ </tbody>
201
+ <tbody>
202
+ <tr>
203
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
204
+ <td><?php _e('Address 1', 'woocommerce-checkout-manager'); ?></td>
205
+ <td><input name="wccs_settings[checkness][wccs_opt_4]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_4'])) echo "checked='checked'"; ?></td>
206
+ <td></td>
207
+ <td></td>
208
+ <td></td>
209
+ </tr>
210
+ </tbody>
211
+ <tbody>
212
+ <tr>
213
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
214
+ <td><?php _e('Address 2', 'woocommerce-checkout-manager'); ?></td>
215
+ <td><input name="wccs_settings[checkness][wccs_opt_5]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_5'])) echo "checked='checked'"; ?> /></td>
216
+ <td></td>
217
+ <td></td>
218
+ <td></td>
219
+ </tr>
220
+ </tbody>
221
+ <tbody>
222
+ <tr>
223
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
224
+ <td><?php _e('City', 'woocommerce-checkout-manager'); ?></td>
225
+ <td><input name="wccs_settings[checkness][wccs_opt_6]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_6'])) echo "checked='checked'"; ?> /></td>
226
+ <td></td>
227
+ <td></td>
228
+ <td></td>
229
+ </tr>
230
+ </tbody>
231
+ <tbody>
232
+ <tr>
233
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
234
+ <td><?php _e('Postal Code', 'woocommerce-checkout-manager'); ?></td>
235
+ <td><input name="wccs_settings[checkness][wccs_opt_7]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_7'])) echo "checked='checked'"; ?> /></td>
236
+ <td></td>
237
+ <td></td>
238
+ <td></td>
239
+ </tr>
240
+ </tbody>
241
+ <tbody>
242
+ <tr>
243
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
244
+ <td><?php _e('State', 'woocommerce-checkout-manager'); ?></td>
245
+ <td><input name="wccs_settings[checkness][wccs_opt_9]" type="checkbox" class="rm" value="1" <?php if ( 1 == ($options['checkness']['wccs_opt_9'])) echo "checked='checked'"; ?> /></td>
246
+ <td></td>
247
+ <td></td>
248
+ <td></td>
249
+ </tr>
250
+ </tbody>
251
+ <?php submit_button( __( 'Save Changes', 'woocommerce-checkout-manager' ) ); ?>
252
+ <div style="margin:5px 0 15px 10px;color:green;font-size:18px;float:left;">= <?php _e('Billing Section', 'woocommerce-checkout-manager'); ?> =</div>
253
+ </table>
254
+ <table class="widefat" border="1" >
255
+ <thead>
256
+ <tr>
257
+ <th><?php _e('Field Name', 'woocommerce-checkout-manager'); ?></th>
258
+ <th><?php _e('Remove Field Entirely', 'woocommerce-checkout-manager'); ?></th>
259
+ <th><?php _e('Remove Required Attribute', 'woocommerce-checkout-manager'); ?></th>
260
+ <th class="wccs_replace"><?php _e('Replace Label Name', 'woocommerce-checkout-manager'); ?></th>
261
+ <th class="wccs_replace"><?php _e('Replace Placeholder Name', 'woocommerce-checkout-manager'); ?></th>
262
+ </tr>
263
+ </thead>
264
+ <tbody>
265
+ <tr>
266
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
267
+ <td><strong><?php _e('Select All Check boxes in this Column', 'woocommerce-checkout-manager'); ?></strong></td>
268
+ <td><input name="wccs_settings[check][select_all_rm_s]" type="checkbox" id="select_all_rm_s" value="1" <?php if ( 1 == ($options['check']['select_all_rm_s'])) echo "checked='checked'"; ?> /></td>
269
+ <td><input name="wccs_settings[check][select_all_rq_s]" type="checkbox" id="select_all_rq_s" value="1" <?php if ( 1 == ($options['check']['select_all_rq_s'])) echo "checked='checked'"; ?> /></td>
270
+ <td></td>
271
+ <td></td>
272
+ </tr>
273
+ </tbody>
274
+ <tbody>
275
+ <tr>
276
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
277
+ <td><?php _e('First Name', 'woocommerce-checkout-manager'); ?></td>
278
+ <td><input name="wccs_settings[check][wccs_opt_1_s]" type="checkbox" class="rm_s" value="1"
279
+ <?php if ( 1 == ($options['check']['wccs_opt_1_s']) ) echo 'checked="checked"'; ?> /></td>
280
+ <td><input name="wccs_settings[check][wccs_rq_1_s]" type="checkbox" class="rq_s" value="1" <?php if ( 1 == ($options['check']['wccs_rq_1_s'])) echo "checked='checked'"; ?> /></td>
281
+ <td><input type="text" name="wccs_settings[replace][label_s]"
282
+ value="<?php echo esc_attr( $options['replace']['label_s'] ); ?>" /></td>
283
+ <td><input type="text" name="wccs_settings[replace][placeholder_s]"
284
+ value="<?php echo esc_attr( $options['replace']['placeholder_s'] ); ?>" /></td>
285
+ </tr>
286
+ </tbody>
287
+ <tbody>
288
+ <tr>
289
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
290
+ <td><?php _e('Last Name', 'woocommerce-checkout-manager'); ?></td>
291
+ <td><input name="wccs_settings[check][wccs_opt_2_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_2_s'])) echo "checked='checked'"; ?> /></td>
292
+ <td><input name="wccs_settings[check][wccs_rq_2_s]" type="checkbox" class="rq_s" value="1" <?php if ( 1 == ($options['check']['wccs_rq_2_s'])) echo "checked='checked'"; ?> /></td>
293
+ <td><input type="text" name="wccs_settings[replace][label_s1]"
294
+ value="<?php echo esc_attr( $options['replace']['label_s1'] ); ?>" /></td>
295
+ <td><input type="text" name="wccs_settings[replace][placeholder_s1]"
296
+ value="<?php echo esc_attr( $options['replace']['placeholder_s1'] ); ?>" /></td>
297
+ </tr>
298
+ </tbody>
299
+ <tbody>
300
+ <tr>
301
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
302
+ <td><?php _e('Company', 'woocommerce-checkout-manager'); ?></td>
303
+ <td><input name="wccs_settings[check][wccs_opt_3_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_3_s'])) echo "checked='checked'"; ?> /></td>
304
+ <td></td>
305
+ <td><input type="text" name="wccs_settings[replace][label_s2]"
306
+ value="<?php echo esc_attr( $options['replace']['label_s2'] ); ?>" /></td>
307
+ <td><input type="text" name="wccs_settings[replace][placeholder_s2]"
308
+ value="<?php echo esc_attr( $options['replace']['placeholder_s2'] ); ?>" /></td>
309
+ </tr>
310
+ </tbody>
311
+ <tbody>
312
+ <tr>
313
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
314
+ <td><?php _e('Country', 'woocommerce-checkout-manager'); ?></td>
315
+ <td><input name="wccs_settings[check][wccs_opt_8_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_8_s'])) echo "checked='checked'"; ?> /></td>
316
+ <td></td>
317
+ <td><input type="text" name="wccs_settings[replace][label_s7]"
318
+ value="<?php echo esc_attr( $options['replace']['label_s7'] ); ?>" /></td>
319
+ <td></td>
320
+ </tr>
321
+ </tbody>
322
+ <tbody>
323
+ <tr>
324
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
325
+ <td><?php _e('Address 1', 'woocommerce-checkout-manager'); ?></td>
326
+ <td><input name="wccs_settings[check][wccs_opt_4_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_4_s'])) echo "checked='checked'"; ?></td>
327
+ <td></td>
328
+ <td></td>
329
+ <td></td>
330
+ </tr>
331
+ </tbody>
332
+ <tbody>
333
+ <tr>
334
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
335
+ <td><?php _e('Address 2', 'woocommerce-checkout-manager'); ?></td>
336
+ <td><input name="wccs_settings[check][wccs_opt_5_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_5_s'])) echo "checked='checked'"; ?> /></td>
337
+ <td></td>
338
+ <td></td>
339
+ <td></td>
340
+ </tr>
341
+ </tbody>
342
+ <tbody>
343
+ <tr>
344
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
345
+ <td><?php _e('City', 'woocommerce-checkout-manager'); ?></td>
346
+ <td><input name="wccs_settings[check][wccs_opt_6_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_6_s'])) echo "checked='checked'"; ?> /></td>
347
+ <td></td>
348
+ <td></td>
349
+ <td></td>
350
+ </tr>
351
+ </tbody>
352
+ <tbody>
353
+ <tr>
354
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
355
+ <td><?php _e('Postal Code', 'woocommerce-checkout-manager'); ?></td>
356
+ <td><input name="wccs_settings[check][wccs_opt_7_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_7_s'])) echo "checked='checked'"; ?> /></td>
357
+ <td></td>
358
+ <td></td>
359
+ <td></td>
360
+ </tr>
361
+ </tbody>
362
+ <tbody>
363
+ <tr>
364
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
365
+ <td><?php _e('State', 'woocommerce-checkout-manager'); ?></td>
366
+ <td><input name="wccs_settings[check][wccs_opt_9_s]" type="checkbox" class="rm_s" value="1" <?php if ( 1 == ($options['check']['wccs_opt_9_s'])) echo "checked='checked'"; ?> /></td>
367
+ <td></td>
368
+ <td></td>
369
+ <td></td>
370
+ </tr>
371
+ </tbody>
372
+ <div style="margin:20px 0 15px 10px;color:green;font-size:18px;float:left;">= <?php _e('Shipping Section', 'woocommerce-checkout-manager'); ?> =</div>
373
+ </table>
374
+ <div style="padding:5px 10px;float:right;font-weight:700;color:green;" class="updated">
375
+ <a href="http://www.trottyzone.com/product/woocommerce-checkout-manager/"><?php _e('PRO VERSION', 'woocommerce-checkout-manager'); ?></a> <?php _e('- now includes Text/ Html Swapper (eg. To Change Billing Address), CheckBox (Input Custom two options), Radio buttons, Select options (Insert more than two options), Password field, Time picker, Color picker etc.', 'woocommerce-checkout-manager'); ?>
376
+ </div>
377
+ <div style="margin:20px 0 15px 10px;color:green;font-size:18px;float:left;">= <?php _e('Add New Field Section', 'woocommerce-checkout-manager'); ?> =</div>
378
+ <table class="widefat" border="1" >
379
+ <thead>
380
+ <tr>
381
+ <th><?php _e('Enable Title - Additional information', 'atc-menu'); ?></th>
382
+ <th>
383
+ <input style="float:left;" name="wccs_settings[checkness][checkbox12]" type="checkbox" value="true" <?php if ( true == ($options['checkness']['checkbox12'])) echo "checked='checked'"; ?> /></th>
384
+ <th><?php _e('Checkout Page', 'atc-menu'); ?></th>
385
+ <th>
386
+ <input style="float:left;" name="wccs_settings[checkness][checkbox1]" type="checkbox" value="true" <?php if ( true == ($options['checkness']['checkbox1'])) echo "checked='checked'"; ?> /></th>
387
+ <th><?php _e('Checkout Details and Email Receipt', 'atc-menu'); ?></th>
388
+ </tr>
389
+ </thead>
390
+ </table>
391
+ <style type="text/css">
392
+ .wccs-clone {
393
+ display:none;
394
+ }
395
+ .widefat input {
396
+ float: right;
397
+ }
398
+ .wccs_replace {
399
+ width: 20%;
400
+ }
401
+ .wccs-order {
402
+ cursor:move;
403
+ }
404
+ .wccs-table > tbody > tr > td {
405
+ background: #fff;
406
+ border-right: 1px solid #ededed;
407
+ border-bottom: 1px solid #ededed;
408
+ padding: 8px;
409
+ position: relative;
410
+ }
411
+ .wccs-table > tbody > tr:last-child td { border-bottom: 0 none; }
412
+ .wccs-table > tbody > tr td:last-child { border-right: 0 none; }
413
+ .wccs-table > thead > tr > th { border-right: 1px solid #e1e1e1; }
414
+ .wccs-table > thead > tr > th:last-child { border-right: 0 none; }
415
+ .wccs-table tr td.wccs-order,
416
+ .wccs-table tr th.wccs-order {
417
+ width: 16px;
418
+ text-align: center;
419
+ vertical-align: middle;
420
+ color: #aaa;
421
+ text-shadow: #fff 0 1px 0;
422
+ }
423
+ .wccs-table .wccs-remove {
424
+ width: 16px;
425
+ vertical-align: middle;
426
+ }
427
+ .wccs-table input[type="text"] {
428
+ width: 100%;
429
+ }
430
+ .wccs-table-footer {
431
+ position: relative;
432
+ overflow: hidden;
433
+ margin-top: 10px;
434
+ padding: 8px 0;
435
+ }
436
+ </style>
437
+ <table class="widefat wccs-table" border="1">
438
+ <thead>
439
+ <tr>
440
+ <th style="width:5%;" class="wccs-order" title="<?php esc_attr_e( 'Change order' , 'woocommerce-checkout-manager' ); ?>"></th>
441
+ <th><?php _e('Label' , 'woocommerce-checkout-manager' ); ?></th>
442
+ <th><?php _e('Placeholder' , 'woocommerce-checkout-manager' ); ?></th>
443
+ <th><?php _e('Option A' , 'woocommerce-checkout-manager' ); ?></th>
444
+ <th><?php _e('Options B' , 'woocommerce-checkout-manager' ); ?></th>
445
+ <th width="15%"><?php _e('Choose Type' , 'woocommerce-checkout-manager' ); ?></th>
446
+ <th width="10%"><?php _e('Abbreviation' , 'woocommerce-checkout-manager' ); ?></th>
447
+ <th width="9%"><?php _e('Required Attribute' , 'woocommerce-checkout-manager' ); ?></th>
448
+ <th scope="col" title="<?php esc_attr_e( 'Remove button', 'woocommerce-checkout-manager' ); ?>"><!-- remove --></th>
449
+ </tr>
450
+ </thead>
451
+ <tbody>
452
+ <?php
453
+ if ( isset ( $options['buttons'] ) ) :
454
+ // Loop through all the buttons
455
+ for ( $i = 0; $i < count( $options['buttons'] ); $i++ ) :
456
+ if ( ! isset( $options['buttons'][$i] ) )
457
+ break;
458
+ ?>
459
+ <tr valign="top" class="wccs-row">
460
+ <td class="wccs-order" title="<?php esc_attr_e( 'Change order', 'woocommerce-checkout-manager' ); ?>"><?php echo $i + 1; ?></td>
461
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
462
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][label]"
463
+ value="<?php echo esc_attr( $options['buttons'][$i][label] ); ?>" /></td>
464
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][placeholder]"
465
+ value="<?php echo esc_attr( $options['buttons'][$i][placeholder] ); ?>" /></td>
466
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_a]"
467
+ value="<?php echo esc_attr( $options['buttons'][$i][option_a] ); ?>" /></td>
468
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_b]"
469
+ value="<?php echo esc_attr( $options['buttons'][$i][option_b] ); ?>" /></td>
470
+ <td>
471
+ <select name="wccs_settings[buttons][<?php echo $i; ?>][type]" > <!--Call run() function-->
472
+ <option value="text" <?php selected( $options['buttons'][$i][type], 'text' ); ?>>Text Input</option>
473
+ <option value="select" <?php selected( $options['buttons'][$i][type], 'select' ); ?>>Select Options</option>
474
+ <option value="date" <?php selected( $options['buttons'][$i][type], 'date' ); ?>>Date Picker</option>
475
+ <option value="checkbox" <?php selected( $options['buttons'][$i][type], 'checkbox' ); ?>>Checkbox (1, 0)</option>
476
+ </select>
477
+ </td>
478
+ <td><input type="text" maxlength="10" name="wccs_settings[buttons][<?php echo $i; ?>][cow]"
479
+ value="<?php echo esc_attr( $options['buttons'][$i][cow] ); ?>" /></td>
480
+ <td style="text-align:center;"><input style="float:none;" name="wccs_settings[buttons][<?php echo $i; ?>][checkbox]" type="checkbox" value="true" <?php if ( true == ($options['buttons'][$i][checkbox])) echo "checked='checked'"; ?> /></td>
481
+ <td class="wccs-remove"><a class="wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Remove Field' , 'woocommerce-checkout-manager' ); ?>">&times;</a></td>
482
+ </tr>
483
+ <?php endfor; endif; ?>
484
+ <!-- Empty -->
485
+ <?php $i = 999; ?>
486
+ <tr valign="top" class="wccs-clone" >
487
+ <td class="wccs-order" title="<?php esc_attr_e( 'Change order' , 'woocommerce-checkout-manager' ); ?>"><?php echo $i; ?></td>
488
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
489
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][label]"
490
+ title="<?php esc_attr_e( 'Label of the New Field', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
491
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][placeholder]"
492
+ title="<?php esc_attr_e( 'Placeholder - Preview of Data to Input', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
493
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_a]"
494
+ title="<?php esc_attr_e( 'Insert Option A', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
495
+ <td><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_b]"
496
+ title="<?php esc_attr_e( 'Insert Option B', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
497
+ <td>
498
+ <select name="wccs_settings[buttons][<?php echo $i; ?>][type]" > <!--Call run() function-->
499
+ <option value="text" >Text Input</option>
500
+ <option value="select" >Select Options</option>
501
+ <option value="date" >Date Picker</option>
502
+ <option value="checkbox" >Checkbox (1, 0)</option>
503
+ </select>
504
+ </td>
505
+ <td><input type="text" maxlength="5" name="wccs_settings[buttons][<?php echo $i; ?>][cow]"
506
+ title="<?php esc_attr_e( 'Abbreviation (No spaces)', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
507
+ <td style="text-align:center;"><input style="float:none;" name="wccs_settings[buttons][<?php echo $i; ?>][checkbox]" type="checkbox"
508
+ title="<?php esc_attr_e( 'Add/Remove Required Attribute', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
509
+ <td class="wccs-remove"><a class="wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Remove Field' , 'woocommerce-checkout-manager' ); ?>">&times;</a></td>
510
+ </tr>
511
+ </tbody>
512
+ </table>
513
+ <div class="wccs-table-footer">
514
+ <a href="javascript:;" id="wccs-add-button" class="button-secondary"><?php _e( '+ Add New Field' , 'woocommerce-checkout-manager' ); ?></a>
515
+ </div>
516
+ </form>
517
+ <?php
518
+ }
519
+ // Build array of links for rendering in installed plugins list
520
+ function wccs_admin_plugin_actions($links) {
521
+ $wccs_plugin_links = array(
522
+ '<a href="options-general.php?page=woocommerce-checkout-manager/woocommerce-checkout-manager.php">'.__('Settings').'</a>',
523
+ '<a href="http://www.trottyzone.com/forums/forum/website-support/">'.__('Support').'</a>',
524
+ );
525
+ return array_merge( $wccs_plugin_links, $links );
526
+ }
527
+ function wccs_scripts( $hook_suffix ) {
528
+ if ( $hook_suffix == 'settings_page_woocommerce-checkout-manager/woocommerce-checkout-manager' ) {
529
+ wp_enqueue_script( 'script_wccs', plugins_url( 'script_wccs.js', __FILE__ ), array( 'jquery' ), '1.2' );
530
+ if(!wp_script_is('jquery-ui-sortable', 'queue')){
531
+ wp_enqueue_script('jquery-ui-sortable');
532
+ }
533
+ }
534
+ }
535
+ add_action( 'admin_enqueue_scripts', 'wccs_scripts' );
536
+ // ================== First Name ===================
537
+ function wccs_override_checkout_fields1($fields1) {
538
+ $options = get_option( 'wccs_settings' );
539
+ if ( 1 == ($options['checkness']['wccs_opt_1'] ) )
540
+ unset($fields1['billing']['billing_first_name']);
541
+ return $fields1;
542
+ }
543
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields1' );
544
+ function wccs_override_required_fields1( $address_fields1 ) {
545
+ $options = get_option( 'wccs_settings' );
546
+ if ( 1 == ($options['checkness']['wccs_rq_1'] ) )
547
+ $address_fields1['billing_first_name']['required'] = false;
548
+ return $address_fields1;
549
+ }
550
+ add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields1', 10, 1 );
551
+ // replace label and placeholder
552
+ function custom_replace_checkout_fields( $fields ) {
553
+ $options = get_option( 'wccs_settings' );
554
+ if ( ! empty( $options['replace']['placeholder'] ) )
555
+ $fields['billing']['billing_first_name']['placeholder'] = ''.$options['replace']['placeholder'].'';
556
+ return $fields;
557
+ }
558
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields' );
559
+ function custom_replace_checkout_fieldsa( $fields ) {
560
+ $options = get_option( 'wccs_settings' );
561
+ if ( ! empty( $options['replace']['label'] ) )
562
+ $fields['billing']['billing_first_name']['label'] = ''.$options['replace']['label'].'';
563
+ return $fields;
564
+ }
565
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsa' );
566
+ // ========== Last Name ==============
567
+ function wccs_override_checkout_fields2($fields2) {
568
+ $options = get_option( 'wccs_settings' );
569
+ if ( 1 == ($options['checkness']['wccs_opt_2'] ) )
570
+ unset($fields2['billing']['billing_last_name']);
571
+ return $fields2;
572
+ }
573
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields2' );
574
+ function wccs_override_required_fields2( $address_fields2 ) {
575
+ $options = get_option( 'wccs_settings' );
576
+ if ( 1 == ($options['checkness']['wccs_rq_2'] ) )
577
+ $address_fields2['billing_last_name']['required'] = false;
578
+ return $address_fields2;
579
+ }
580
+ add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields2', 10, 1 );
581
+ // replace label and placeholder
582
+ function custom_replace_checkout_fields1( $fields ) {
583
+ $options = get_option( 'wccs_settings' );
584
+ if ( ! empty( $options['replace']['placeholder1'] ) )
585
+ $fields['billing']['billing_last_name']['placeholder'] = ''.$options['replace']['placeholder1'].'';
586
+ return $fields;
587
+ }
588
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields1' );
589
+ function custom_replace_checkout_fieldsb( $fields ) {
590
+ $options = get_option( 'wccs_settings' );
591
+ if ( ! empty( $options['replace']['label1'] ) )
592
+ $fields['billing']['billing_last_name']['label'] = ''.$options['replace']['label1'].'';
593
+ return $fields;
594
+ }
595
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsb' );
596
+ // ============ Company ==============
597
+ function wccs_override_checkout_fields3($fields3) {
598
+ $options = get_option( 'wccs_settings' );
599
+ if ( 1 == ($options['checkness']['wccs_opt_3'] ) )
600
+ unset($fields3['billing']['billing_company']);
601
+ return $fields3;
602
+ }
603
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields3' );
604
+ // replace label and placeholder
605
+ function custom_replace_checkout_fields2( $fields ) {
606
+ $options = get_option( 'wccs_settings' );
607
+ if ( ! empty( $options['replace']['placeholder2'] ) )
608
+ $fields['billing']['billing_company']['placeholder'] = ''.$options['replace']['placeholder2'].'';
609
+ return $fields;
610
+ }
611
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields2' );
612
+ function custom_replace_checkout_fieldsc( $fields ) {
613
+ $options = get_option( 'wccs_settings' );
614
+ if ( ! empty( $options['replace']['label5'] ) )
615
+ $fields['billing']['billing_company']['label'] = ''.$options['replace']['label5'].'';
616
+ return $fields;
617
+ }
618
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsc' );
619
+ // ============ Address 1 ==============
620
+ function wccs_override_checkout_fields4($fields4) {
621
+ $options = get_option( 'wccs_settings' );
622
+ if ( 1 == ($options['checkness']['wccs_opt_4'] ) )
623
+ unset($fields4['billing']['billing_address_1']);
624
+ return $fields4;
625
+ }
626
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields4' );
627
+ // ============ Address 2 ===============
628
+ function wccs_override_checkout_fields5($fields5) {
629
+ $options = get_option( 'wccs_settings' );
630
+ if ( 1 == ($options['checkness']['wccs_opt_5'] ) )
631
+ unset($fields5['billing']['billing_address_2']);
632
+ return $fields5;
633
+ }
634
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields5' );
635
+ // ============= City ================
636
+ function wccs_override_checkout_fields6($fields6) {
637
+ $options = get_option( 'wccs_settings' );
638
+ if ( 1 == ($options['checkness']['wccs_opt_6'] ) )
639
+ unset($fields6['billing']['billing_city']);
640
+ return $fields6;
641
+ }
642
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields6' );
643
+ // ============= Postal Code ================
644
+ function wccs_override_checkout_fields7($fields7) {
645
+ $options = get_option( 'wccs_settings' );
646
+ if ( 1 == ($options['checkness']['wccs_opt_7'] ) )
647
+ unset($fields7['billing']['billing_postcode']);
648
+ return $fields7;
649
+ }
650
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields7' );
651
+ // =================== Country==================
652
+ function wccs_override_checkout_fields8($fields8) {
653
+ $options = get_option( 'wccs_settings' );
654
+ if ( 1 == ($options['checkness']['wccs_opt_8'] ) )
655
+ unset($fields8['billing']['billing_country']);
656
+ return $fields8;
657
+ }
658
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields8' );
659
+ function wccs_override_required_fields8( $address_fields8 ) {
660
+ $options = get_option( 'wccs_settings' );
661
+ if ( 1 == ($options['checkness']['wccs_rq_8'] ) )
662
+ $address_fields8['billing_country']['required'] = false;
663
+ return $address_fields8;
664
+ }
665
+ add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields8', 10, 1 );
666
+ function custom_replace_checkout_fieldsh( $fields ) {
667
+ $options = get_option( 'wccs_settings' );
668
+ if ( ! empty( $options['replace']['label2'] ) )
669
+ $fields['billing']['billing_country']['label'] = ''.$options['replace']['label2'].'';
670
+ return $fields;
671
+ }
672
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsh' );
673
+ // ================= State ===================
674
+ function wccs_override_checkout_fields9($fields9) {
675
+ $options = get_option( 'wccs_settings' );
676
+ if ( 1 == ($options['checkness']['wccs_opt_9'] ) )
677
+ unset($fields9['billing']['billing_state']);
678
+ return $fields9;
679
+ }
680
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields9' );
681
+ // =============== Phone ======================
682
+ function wccs_override_checkout_fields10($fields10) {
683
+ $options = get_option( 'wccs_settings' );
684
+ if ( 1 == ($options['checkness']['wccs_opt_10'] ) )
685
+ unset($fields10['billing']['billing_phone']);
686
+ return $fields10;
687
+ }
688
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields10' );
689
+ function wccs_override_required_fields10( $address_fields10 ) {
690
+ $options = get_option( 'wccs_settings' );
691
+ if ( 1 == ($options['checkness']['wccs_rq_10'] ) )
692
+ $address_fields10['billing_phone']['required'] = false;
693
+ return $address_fields10;
694
+ }
695
+ add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields10', 10, 1 );
696
+ // replace label and placeholder
697
+ function custom_replace_checkout_fields9( $fields ) {
698
+ $options = get_option( 'wccs_settings' );
699
+ if ( ! empty( $options['replace']['placeholder3'] ) )
700
+ $fields['billing']['billing_phone']['placeholder'] = ''.$options['replace']['placeholder3'].'';
701
+ return $fields;
702
+ }
703
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields9' );
704
+ function custom_replace_checkout_fieldsj( $fields ) {
705
+ $options = get_option( 'wccs_settings' );
706
+ if ( ! empty( $options['replace']['label3'] ) )
707
+ $fields['billing']['billing_phone']['label'] = ''.$options['replace']['label3'].'';
708
+ return $fields;
709
+ }
710
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsj' );
711
+ // ==================== Email ========================
712
+ function wccs_override_checkout_fields11($fields11) {
713
+ $options = get_option( 'wccs_settings' );
714
+ if ( 1 == ($options['checkness']['wccs_opt_11'] ) )
715
+ unset($fields11['billing']['billing_email']);
716
+ return $fields11;
717
+ }
718
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields11' );
719
+ function wccs_override_required_fields11( $address_fields11 ) {
720
+ $options = get_option( 'wccs_settings' );
721
+ if ( 1 == ($options['checkness']['wccs_rq_11'] ) )
722
+ $address_fields11['billing_email']['required'] = false;
723
+ return $address_fields11;
724
+ }
725
+ add_filter( 'woocommerce_billing_fields', 'wccs_override_required_fields11', 10, 1 );
726
+ // replace label and placeholder
727
+ function custom_replace_checkout_fields10( $fields ) {
728
+ $options = get_option( 'wccs_settings' );
729
+ if ( ! empty( $options['replace']['placeholder4'] ) )
730
+ $fields['billing']['billing_email']['placeholder'] = ''.$options['replace']['placeholder4'].'';
731
+ return $fields;
732
+ }
733
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields10' );
734
+ function custom_replace_checkout_fieldsk( $fields ) {
735
+ $options = get_option( 'wccs_settings' );
736
+ if ( ! empty( $options['replace']['label4'] ) )
737
+ $fields['billing']['billing_email']['label'] = ''.$options['replace']['label4'].'';
738
+ return $fields;
739
+ }
740
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsk' );
741
+ // ===================== Order Comments ==========================
742
+ function wccs_override_checkout_fields12($fields12) {
743
+ $options = get_option( 'wccs_settings' );
744
+ if ( 1 == ($options['checkness']['wccs_opt_12'] ) )
745
+ unset($fields12['order']['order_comments']);
746
+ return $fields12;
747
+ }
748
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_override_checkout_fields12' );
749
+ // replace label and placeholder
750
+ function custom_replace_checkout_fields11( $fields ) {
751
+ $options = get_option( 'wccs_settings' );
752
+ if ( ! empty( $options['replace']['placeholder11'] ) )
753
+ $fields['order']['order_comments']['placeholder'] = ''.$options['replace']['placeholder11'].'';
754
+ return $fields;
755
+ }
756
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fields11' );
757
+ function custom_replace_checkout_fieldsl( $fields ) {
758
+ $options = get_option( 'wccs_settings' );
759
+ if ( ! empty( $options['replace']['label11'] ) )
760
+ $fields['order']['order_comments']['label'] = ''.$options['replace']['label11'].'';
761
+ return $fields;
762
+ }
763
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldsl' );
764
+ function wccs_add_title() {
765
+ $options = get_option( 'wccs_settings' );
766
+ if (true == ($options['checkness']['checkbox12']) )
767
+ echo '<div class="add_info_wccs"><br><h3>' . __( 'Additional information', 'woocommerce-checkout-manager' ) . '</h3></div>';
768
+ }
769
+ add_action('woocommerce_after_checkout_billing_form', 'wccs_add_title');
770
+ // =============== Add the field to the checkout =====================
771
+ function wccs_custom_checkout_field( $checkout ) {
772
+ $options = get_option( 'wccs_settings' );
773
+ if ( count( $options['buttons'] ) > 0 ) : ?>
774
+ <?php
775
+ $i = 0;
776
+ // Loop through each button
777
+ foreach ( $options['buttons'] as $btn ) :
778
+ $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
779
+ ?>
780
+ <?php
781
+ if ( ! empty( $btn['label'] ) && ($btn['type'] == 'text') ) {
782
+ woocommerce_form_field( ''.$btn['cow'].'' , array(
783
+ 'type' => 'text',
784
+ 'class' => array('wccs-field-class wccs-form-row-wide'),
785
+ 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
786
+ 'required' => $btn['checkbox'],
787
+ 'placeholder' => ''.$btn['placeholder'].'',
788
+ ), $checkout->get_value( ''.$btn['cow'].'' ));
789
+ }
790
+ if ( ! empty( $btn['label'] ) && ($btn['type'] == 'select') ) {
791
+ woocommerce_form_field( ''.$btn['cow'].'' , array(
792
+ 'type' => 'select',
793
+ 'class' => array('wccs-field-class wccs-form-row-wide'),
794
+ 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
795
+ 'options' => array(
796
+ '' => __('Select below', 'woocommerce-checkout-manager' ),
797
+ ''.$btn['option_a'].'' => __(''.$btn['option_a'].'', 'woocommerce-checkout-manager' ),
798
+ ''.$btn['option_b'].'' => __(''.$btn['option_b'].'', 'woocommerce-checkout-manager' )
799
+ ),
800
+ 'required' => $btn['checkbox'],
801
+ 'placeholder' => ''.$btn['placeholder'].'',
802
+ ), $checkout->get_value( ''.$btn['cow'].'' ));
803
+ }
804
+ if ( ! empty( $btn['label'] ) && ($btn['type'] == 'date') ) {
805
+ echo '<script type="text/javascript">
806
+ jQuery(document).ready(function() {
807
+ jQuery(".MyDate-'.$btn['cow'].' #'.$btn['cow'].'").datepicker({
808
+ dateFormat : "dd-mm-yy"
809
+ });
810
+ });
811
+ </script>';
812
+ woocommerce_form_field( ''.$btn['cow'].'' , array(
813
+ 'type' => 'text',
814
+ 'class' => array('wccs-field-class MyDate-'.$btn['cow'].' wccs-form-row-wide'),
815
+ 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
816
+ 'required' => $btn['checkbox'],
817
+ 'placeholder' => ''.$btn['placeholder'].'',
818
+ ), $checkout->get_value( ''.$btn['cow'].'' ));
819
+ }
820
+ if ( ! empty( $btn['label'] ) && ($btn['type'] == 'checkbox') ) {
821
+ woocommerce_form_field( ''.$btn['cow'].'' , array(
822
+ 'type' => 'checkbox',
823
+ 'class' => array('wccs-field-class wccs-form-row-wide'),
824
+ 'label' => __(''.$btn['label'].'', 'woocommerce-checkout-manager' ),
825
+ 'required' => $btn['checkbox'],
826
+ 'placeholder' => ''.$btn['placeholder'].'',
827
+ ), $checkout->get_value( ''.$btn['cow'].'' ));
828
+ }
829
+ ?>
830
+ <?php
831
+ $i++;
832
+ endforeach;
833
+ ?>
834
+ <?php
835
+ endif;
836
+ }
837
+ add_action('woocommerce_after_checkout_billing_form', 'wccs_custom_checkout_field');
838
+ // ============================== Update the order meta with field value ==============================
839
+ function wccs_custom_checkout_field_update_order_meta( $order_id ) {
840
+ $options = get_option( 'wccs_settings' );
841
+ if ( count( $options['buttons'] ) > 0 ) :
842
+ $i = 0;
843
+ // Loop through each button
844
+ foreach ( $options['buttons'] as $btn ) :
845
+ $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
846
+ if ( ! empty( $btn['label'] ) )
847
+ if ( $_POST[ ''.$btn['cow'].'' ])
848
+ update_post_meta( $order_id, ''.$btn['label'].'' , esc_attr( $_POST[ ''.$btn['cow'].'' ] ));
849
+ $i++;
850
+ endforeach;
851
+ endif;
852
+ }
853
+ add_action('woocommerce_checkout_update_order_meta', 'wccs_custom_checkout_field_update_order_meta');
854
+ // =============== Add to email (working) =====================
855
+ add_filter('woocommerce_email_order_meta_keys', 'wccs_custom_checkout_field_order_meta_keys');
856
+ function wccs_custom_checkout_field_order_meta_keys( $keys ) {
857
+ $options = get_option( 'wccs_settings' );
858
+ if ( count( $options['buttons'] ) > 0 ) :
859
+ $i = 0;
860
+ // Loop through each button
861
+ foreach ( $options['buttons'] as $btn ) :
862
+ $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
863
+ if ( ! empty( $btn['label'] ) )
864
+ $keys[] = ''.$btn['label'].'';
865
+ $i++;
866
+ endforeach;
867
+ return $keys;
868
+ endif;
869
+ }
870
+ // ================ Style the Email =======================
871
+ add_action('woocommerce_email_after_order_table', 'wccs_custom_style_checkout_email');
872
+ function wccs_custom_style_checkout_email() {
873
+ $options = get_option( 'wccs_settings' );
874
+ if (true == ($options['checkness']['checkbox1']) )
875
+ echo '<h2>' . __( 'Additional information', 'woocommerce-checkout-manager' ) . '</h2>';
876
+ }
877
+ // ============== Process the checkout (if needed activate) ==================
878
+ function wccs_custom_checkout_field_process() {
879
+ $options = get_option( 'wccs_settings' );
880
+ if ( count( $options['buttons'] ) > 0 ) :
881
+ $i = 0;
882
+ // Loop through each button
883
+ foreach ( $options['buttons'] as $btn ) :
884
+ $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
885
+ global $woocommerce;
886
+ if ( (!$_POST[ ''.$btn['cow'].'' ] ) && (true == ($btn['checkbox']) ) )
887
+ $woocommerce->add_error( '<strong>'.$btn['label'].'</strong> '. __('is a required field', 'woocommerce-checkout-manager' ) . ' ');
888
+ $i++;
889
+ endforeach;
890
+ endif;
891
+ }
892
+ add_action('woocommerce_checkout_process', 'wccs_custom_checkout_field_process');
893
+ function wccs_options_validatew() {
894
+ $options = get_option( 'wccs_settings' );
895
+ if ( empty( $options['replace']['label'] ) )
896
+ unset( $options['replace']['label'] );
897
+ }
898
+ function wccs_options_validate( $input ) {
899
+ $options = get_option( 'wccs_settings' );
900
+ // Don't save empty inputs
901
+ foreach( $input['buttons'] as $i => $btn ) :
902
+ if ( empty( $btn['label'] ) )
903
+ unset( $input['buttons'][$i], $btn );
904
+ endforeach;
905
+ $input['buttons'] = array_values( $input['buttons'] );
906
+ return $input;
907
+ }
908
+ function wccs_custom_checkout_details( $order_id ) {
909
+ $options = get_option( 'wccs_settings' );
910
+ if (true == ($options['checkness']['checkbox1']) ) {
911
+ echo '<h2>' . __( 'Additional information', 'woocommerce-checkout-manager' ) . '</h2>';
912
+ }
913
+ if ( count( $options['buttons'] ) > 0 ) :
914
+ $i = 0;
915
+ // Loop through each button
916
+ foreach ( $options['buttons'] as $btn ) :
917
+ $label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
918
+ $order_object = new WC_Order( $order_id );
919
+ echo '<dt>'.$btn['label'].':</dt><dd>'.get_post_meta( $order_id->id , ''.$btn['label'].'', true).'</dd>';
920
+ $i++;
921
+ endforeach;
922
+ endif;
923
+ }
924
+ add_action('woocommerce_order_details_after_order_table', 'wccs_custom_checkout_details');
925
+ // ================== First Name ===================
926
+ function wccs_shipping_checkout_fields1( $fields1 ) {
927
+ $options = get_option( 'wccs_settings' );
928
+ if ( 1 == ($options['check']['wccs_opt_1_s'] ) )
929
+ unset($fields1['shipping']['shipping_first_name']);
930
+ return $fields1;
931
+ }
932
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_shipping_checkout_fields1' );
933
+ function wccs_shipping_required_fields1( $address_fields1 ) {
934
+ $options = get_option( 'wccs_settings' );
935
+ if ( 1 == ($options['check']['wccs_rq_1_s'] ) )
936
+ $address_fields1['shipping_first_name']['required'] = false;
937
+ return $address_fields1;
938
+ }
939
+ add_filter( 'woocommerce_shipping_fields', 'wccs_shipping_required_fields1', 10, 1 );
940
+ // replace label and placeholder
941
+ function custom_replace_checkout_fieldss( $fields ) {
942
+ $options = get_option( 'wccs_settings' );
943
+ if ( ! empty( $options['replace']['placeholder_s'] ) )
944
+ $fields['shipping']['shipping_first_name']['placeholder'] = ''.$options['replace']['placeholder_s'].'';
945
+ return $fields;
946
+ }
947
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldss' );
948
+ function custom_replace_checkout_fieldssa( $fields ) {
949
+ $options = get_option( 'wccs_settings' );
950
+ if ( ! empty( $options['replace']['label_s'] ) )
951
+ $fields['shipping']['shipping_first_name']['label'] = ''.$options['replace']['label_s'].'';
952
+ return $fields;
953
+ }
954
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssa' );
955
+ // ========== Last Name ==============
956
+ function wccs_shipping_checkout_fields2( $fields2 ) {
957
+ $options = get_option( 'wccs_settings' );
958
+ if ( 1 == ($options['check']['wccs_opt_2_s'] ) )
959
+ unset($fields2['shipping']['shipping_last_name']);
960
+ return $fields2;
961
+ }
962
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_shipping_checkout_fields2' );
963
+ function wccs_shipping_required_fields2( $address_fields2 ) {
964
+ $options = get_option( 'wccs_settings' );
965
+ if ( 1 == ($options['check']['wccs_rq_2_s'] ) )
966
+ $address_fields2['shipping_last_name']['required'] = false;
967
+ return $address_fields2;
968
+ }
969
+ add_filter( 'woocommerce_shipping_fields', 'wccs_shipping_required_fields2', 10, 1 );
970
+ // replace label and placeholder
971
+ function custom_replace_checkout_fieldss1( $fields ) {
972
+ $options = get_option( 'wccs_settings' );
973
+ if ( ! empty( $options['replace']['placeholder_s1'] ) )
974
+ $fields['shipping']['shipping_last_name']['placeholder'] = ''.$options['replace']['placeholder_s1'].'';
975
+ return $fields;
976
+ }
977
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldss1' );
978
+ function custom_replace_checkout_fieldssb( $fields ) {
979
+ $options = get_option( 'wccs_settings' );
980
+ if ( ! empty( $options['replace']['label_s1'] ) )
981
+ $fields['shipping']['shipping_last_name']['label'] = ''.$options['replace']['label_s1'].'';
982
+ return $fields;
983
+ }
984
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssb' );
985
+ // ============ Company ==============
986
+ function wccs_shipping_checkout_fields3( $fields3 ) {
987
+ $options = get_option( 'wccs_settings' );
988
+ if ( 1 == ($options['check']['wccs_opt_3_s'] ) )
989
+ unset($fields3['shipping']['shipping_company']);
990
+ return $fields3;
991
+ }
992
+ add_filter( 'woocommerce_checkout_fields' , 'wccs_shipping_checkout_fields3' );
993
+ // replace label and placeholder
994
+ function custom_replace_checkout_fieldss2( $fields ) {
995
+ $options = get_option( 'wccs_settings' );
996
+ if ( ! empty( $options['replace']['placeholder_s2'] ) )
997
+ $fields['shipping']['shipping_company']['placeholder'] = ''.$options['replace']['placeholder_s2'].'';
998
+ return $fields;
999
+ }
1000
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldss2' );
1001
+ function custom_replace_checkout_fieldssc( $fields ) {
1002
+ $options = get_option( 'wccs_settings' );
1003
+ if ( ! empty( $options['replace']['label_s2'] ) )
1004
+ $fields['shipping']['shipping_company']['label'] = ''.$options['replace']['label_s2'].'';
1005
+ return $fields;
1006
+ }
1007
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssc' );
1008
+ // Hook in
1009
+ add_filter( 'woocommerce_checkout_fields' , 'b1_custom_override_checkout_fields' );
1010
+ // Our hooked in function - $fields is passed via the filter!
1011
+ function b1_custom_override_checkout_fields( $fields ) {
1012
+ $options = get_option( 'wccs_settings' );
1013
+ if ( 1 == ($options['check']['wccs_opt_4_s'] ) )
1014
+ unset($fields['shipping']['shipping_address_1']);
1015
+ return $fields;
1016
+ }
1017
+ // Hook in
1018
+ add_filter( 'woocommerce_checkout_fields' , 'b2_custom_override_checkout_fields' );
1019
+ // Our hooked in function - $fields is passed via the filter!
1020
+ function b2_custom_override_checkout_fields( $fields ) {
1021
+ $options = get_option( 'wccs_settings' );
1022
+ if ( 1 == ($options['check']['wccs_opt_5_s'] ) )
1023
+ unset($fields['shipping']['shipping_address_2']);
1024
+ return $fields;
1025
+ }
1026
+ // Hook in
1027
+ add_filter( 'woocommerce_checkout_fields' , 'c_custom_override_checkout_fields' );
1028
+ // Our hooked in function - $fields is passed via the filter!
1029
+ function c_custom_override_checkout_fields( $fields ) {
1030
+ $options = get_option( 'wccs_settings' );
1031
+ if ( 1 == ($options['check']['wccs_opt_6_s'] ) )
1032
+ unset($fields['shipping']['shipping_city']);
1033
+ return $fields;
1034
+ }
1035
+ // Hook in
1036
+ add_filter( 'woocommerce_checkout_fields' , 'sp_custom_override_checkout_fields' );
1037
+ // Our hooked in function - $fields is passed via the filter!
1038
+ function sp_custom_override_checkout_fields( $fields ) {
1039
+ $options = get_option( 'wccs_settings' );
1040
+ if ( 1 == ($options['check']['wccs_opt_7_s'] ) )
1041
+ unset($fields['shipping']['shipping_postcode']);
1042
+ return $fields;
1043
+ }
1044
+ // =================== Shipping Country ======================
1045
+ // Hook in
1046
+ add_filter( 'woocommerce_checkout_fields' , 'sc_custom_override_checkout_fields' );
1047
+ // Our hooked in function - $fields is passed via the filter!
1048
+ function sc_custom_override_checkout_fields( $fields ) {
1049
+ $options = get_option( 'wccs_settings' );
1050
+ if ( 1 == ($options['check']['wccs_opt_8_s'] ) )
1051
+ unset($fields['shipping']['shipping_country']);
1052
+ return $fields;
1053
+ }
1054
+ // replace label and placeholder
1055
+ function custom_replace_checkout_fieldssd( $fields ) {
1056
+ $options = get_option( 'wccs_settings' );
1057
+ if ( ! empty( $options['replace']['label_s7'] ) )
1058
+ $fields['shipping']['shipping_country']['label'] = ''.$options['replace']['label_s7'].'';
1059
+ return $fields;
1060
+ }
1061
+ add_filter( 'woocommerce_checkout_fields' , 'custom_replace_checkout_fieldssd' );
1062
+ // Hook in
1063
+ add_filter( 'woocommerce_checkout_fields' , 'ss_custom_override_checkout_fields' );
1064
+ // Our hooked in function - $fields is passed via the filter!
1065
+ function ss_custom_override_checkout_fields( $fields ) {
1066
+ $options = get_option( 'wccs_settings' );
1067
+ if ( 1 == ($options['check']['wccs_opt_9_s'] ) )
1068
+ unset($fields['shipping']['shipping_state']);
1069
+ return $fields;
1070
+ }
1071
+ function display_front_wccs() {
1072
+ echo '<style type="text/css">
1073
+ .wccs-field-class {
1074
+ float:left;
1075
+ width: 47%;
1076
+ }
1077
+ .wccs-field-class:nth-child(2n+2) {
1078
+ float: right;
1079
+ }
1080
+ .add_info_wccs {
1081
+ clear: both;
1082
+ }
1083
+ </style>';
1084
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1085
  add_action('wp_head','display_front_wccs');