Version Description
Bug fix.
=
Download this release
Release Info
Developer | Emark |
Plugin | WooCommerce Checkout Manager |
Version | 3.5.9 |
Comparing to | |
See all releases |
Code changes from version 3.5.81 to 3.5.9
- readme.txt +54 -32
- script_wccs.js +92 -112
- woocommerce-checkout-manager.php +1084 -1435
readme.txt
CHANGED
@@ -1,42 +1,64 @@
|
|
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.
|
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 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
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
|
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(
|
11 |
-
jQuery(function() {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
});
|
16 |
-
});
|
17 |
-
|
18 |
-
|
19 |
-
jQuery(
|
20 |
-
|
21 |
-
jQuery('
|
22 |
-
|
23 |
-
|
24 |
-
});
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
jQuery(
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
//
|
45 |
-
function
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
};
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
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
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
Author:
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
),
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
//
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
//
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
//
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
<
|
118 |
-
|
119 |
-
<?php
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
<
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
<
|
156 |
-
|
157 |
-
<
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
<
|
169 |
-
|
170 |
-
<input type="
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
<
|
180 |
-
|
181 |
-
<input type="
|
182 |
-
<td
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
<
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
<
|
204 |
-
|
205 |
-
|
206 |
-
<td
|
207 |
-
|
208 |
-
|
209 |
-
</
|
210 |
-
|
211 |
-
<tbody>
|
212 |
-
<tr>
|
213 |
-
<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
|
214 |
-
<td><?php _e('
|
215 |
-
<td><input name="wccs_settings[checkness][
|
216 |
-
<td
|
217 |
-
|
218 |
-
<td
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
<
|
225 |
-
|
226 |
-
<
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<
|
232 |
-
|
233 |
-
|
234 |
-
<td
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
<
|
242 |
-
|
243 |
-
|
244 |
-
<td
|
245 |
-
|
246 |
-
<td
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
<
|
256 |
-
|
257 |
-
<
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
<
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
<
|
275 |
-
|
276 |
-
|
277 |
-
<td
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
</
|
286 |
-
|
287 |
-
|
288 |
-
<
|
289 |
-
|
290 |
-
<
|
291 |
-
<td
|
292 |
-
<td><input name="wccs_settings[
|
293 |
-
|
294 |
-
|
295 |
-
<td
|
296 |
-
|
297 |
-
</
|
298 |
-
|
299 |
-
<tbody>
|
300 |
-
<tr>
|
301 |
-
<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
|
302 |
-
<td><?php _e('
|
303 |
-
<td><input name="wccs_settings[
|
304 |
-
|
305 |
-
<td
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
<
|
313 |
-
|
314 |
-
<td
|
315 |
-
<td
|
316 |
-
<td></td>
|
317 |
-
<td
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
<
|
324 |
-
|
325 |
-
<td
|
326 |
-
<td
|
327 |
-
<td></td>
|
328 |
-
<td></td>
|
329 |
-
|
330 |
-
</
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
<
|
335 |
-
|
336 |
-
<input type="
|
337 |
-
<td
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
<?php
|
347 |
-
|
348 |
-
<
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
<
|
354 |
-
|
355 |
-
<
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
<
|
367 |
-
|
368 |
-
<
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
<
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
<
|
379 |
-
|
380 |
-
<
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
<
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
<
|
442 |
-
|
443 |
-
<
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
<
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
<td
|
461 |
-
<
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
<
|
473 |
-
<
|
474 |
-
|
475 |
-
</
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
<td
|
498 |
-
<
|
499 |
-
|
500 |
-
</
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
</
|
505 |
-
|
506 |
-
|
507 |
-
<
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
<
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
<
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
return
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
$
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
if (
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
$
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
}
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
}
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
}
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
$
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
//
|
861 |
-
|
862 |
-
$
|
863 |
-
if (
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
//
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
}
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
}
|
913 |
-
|
914 |
-
|
915 |
-
//
|
916 |
-
|
917 |
-
$
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
function
|
934 |
-
$options = get_option( 'wccs_settings' );
|
935 |
-
if (
|
936 |
-
|
937 |
-
|
938 |
-
}
|
939 |
-
add_filter( '
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
$fields
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
function
|
979 |
-
$options = get_option( 'wccs_settings' );
|
980 |
-
if ( ! empty( $options['replace']['
|
981 |
-
$fields['
|
982 |
-
return $fields;
|
983 |
-
}
|
984 |
-
add_filter( 'woocommerce_checkout_fields' , '
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
$
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
$
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
$
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
$
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
echo '<
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
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' ); ?>">×</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' ); ?>">×</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');
|