PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.2.1
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.2.1
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / elementor / modules / checkout / widgets / settings-controls.php

settings-controls.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.2.1, at includes/elementor/modules/checkout/widgets/settings-controls.php

897 lines 25.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Elementor\Modules\Checkout\Widgets;
4
5 defined( 'ABSPATH' ) || die();
6
7 use Elementor\Settings;
8
9 /**
10 * Checkout settings controls.
11 *
12 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
13 * @since 1.1.0
14 */
15 class Settings_Controls extends \Sellkit_Elementor_Checkout_Widget {
16 public function __construct() {
17 $this->layout_settings();
18 $this->google_autocomplete_settings();
19 $this->coupon_form_visibility();
20 $this->shipping_fields();
21 $this->billing_fields();
22 $this->custom_messages();
23 }
24
25 private function shipping_fields_type() {
26 $fields = [
27 'shipping_first_name' => esc_html__( 'Shipping First Name', 'sellkit' ),
28 'shipping_last_name' => esc_html__( 'Shipping Last Name', 'sellkit' ),
29 'shipping_company' => esc_html__( 'Shipping Company', 'sellkit' ),
30 'shipping_address_1' => esc_html__( 'Shipping Address 1', 'sellkit' ),
31 'shipping_address_2' => esc_html__( 'Shipping Address 2', 'sellkit' ),
32 'shipping_city' => esc_html__( 'Shipping City', 'sellkit' ),
33 'shipping_postcode' => esc_html__( 'Shipping Postcode', 'sellkit' ),
34 'shipping_country' => esc_html__( 'Shipping Country', 'sellkit' ),
35 'shipping_state' => esc_html__( 'Shipping State', 'sellkit' ),
36 ];
37
38 if ( sellkit()->has_pro ) {
39 $fields = \Sellkit_Elementor_Checkout_Pro_Module::checkout_custom_fields( $fields );
40 }
41
42 return $fields;
43 }
44
45 private function billing_fields_type() {
46 $fields = [
47 'billing_first_name' => esc_html__( 'Billing First Name', 'sellkit' ),
48 'billing_last_name' => esc_html__( 'Billing Last Name', 'sellkit' ),
49 'billing_company' => esc_html__( 'Billing Company', 'sellkit' ),
50 'billing_address_1' => esc_html__( 'Billing Address 1', 'sellkit' ),
51 'billing_address_2' => esc_html__( 'Billing Address 2', 'sellkit' ),
52 'billing_city' => esc_html__( 'Billing City', 'sellkit' ),
53 'billing_postcode' => esc_html__( 'Billing Postcode', 'sellkit' ),
54 'billing_country' => esc_html__( 'Billing Country', 'sellkit' ),
55 'billing_state' => esc_html__( 'Billing State', 'sellkit' ),
56 'billing_phone' => esc_html__( 'Billing Phone', 'sellkit' ),
57 ];
58
59 if ( sellkit()->has_pro ) {
60 $fields = \Sellkit_Elementor_Checkout_Pro_Module::checkout_custom_fields( $fields );
61 }
62
63 return $fields;
64 }
65
66 private function layout_settings() {
67 $this->start_controls_section(
68 'section_content',
69 [
70 'label' => esc_html__( 'Content', 'sellkit' ),
71 ]
72 );
73
74 $this->add_control(
75 'layout-type',
76 [
77 'label' => esc_html__( 'Layout', 'sellkit' ),
78 'type' => 'select',
79 'default' => 'one-page',
80 'options' => [
81 'one-page' => esc_html__( 'Single Page', 'sellkit' ),
82 'multi-step' => esc_html__( 'Multi Steps', 'sellkit' ),
83 ],
84 ]
85 );
86
87 $this->add_control(
88 'show_cart_items',
89 [
90 'label' => esc_html__( 'Cart Items', 'sellkit' ),
91 'type' => 'switcher',
92 'label_on' => esc_html__( 'Show', 'sellkit' ),
93 'label_off' => esc_html__( 'Hide', 'sellkit' ),
94 'return_value' => 'yes',
95 'default' => 'yes',
96 ]
97 );
98
99 $this->add_control(
100 'show_cart_edit',
101 [
102 'label' => esc_html__( 'Enable Cart Editing', 'sellkit' ),
103 'type' => 'switcher',
104 'label_on' => esc_html__( 'Show', 'sellkit' ),
105 'label_off' => esc_html__( 'Hide', 'sellkit' ),
106 'return_value' => 'yes',
107 'default' => 'yes',
108 'condition' => [
109 'show_cart_items' => 'yes',
110 ],
111 ]
112 );
113
114 $this->add_control(
115 'show_breadcrumb',
116 [
117 'label' => esc_html__( 'Steps', 'sellkit' ),
118 'type' => 'switcher',
119 'label_on' => esc_html__( 'Show', 'sellkit' ),
120 'label_off' => esc_html__( 'Hide', 'sellkit' ),
121 'return_value' => 'yes',
122 'default' => 'yes',
123 'condition' => [
124 'layout-type' => 'multi-step',
125 ],
126 ]
127 );
128
129 $this->add_control(
130 'show_shipping_method',
131 [
132 'label' => esc_html__( 'Shipping Method', 'sellkit' ),
133 'type' => 'switcher',
134 'label_on' => esc_html__( 'Show', 'sellkit' ),
135 'label_off' => esc_html__( 'Hide', 'sellkit' ),
136 'return_value' => 'yes',
137 'default' => 'yes',
138 ]
139 );
140
141 $this->add_control(
142 'show_preview_box',
143 [
144 'label' => esc_html__( 'Preview Box', 'sellkit' ),
145 'type' => 'switcher',
146 'label_on' => esc_html__( 'Show', 'sellkit' ),
147 'label_off' => esc_html__( 'Hide', 'sellkit' ),
148 'return_value' => 'yes',
149 'default' => 'yes',
150 'condition' => [
151 'layout-type' => 'multi-step',
152 ],
153 ]
154 );
155
156 if ( sellkit()->has_pro ) {
157 \Sellkit_Elementor_Checkout_Pro_Module::express_checkout_control( $this );
158 }
159
160 $this->add_control(
161 'show_sticky_cart_details',
162 [
163 'label' => esc_html__( 'Checkout Sticky Cart', 'sellkit' ),
164 'type' => 'switcher',
165 'label_on' => esc_html__( 'Show', 'sellkit' ),
166 'label_off' => esc_html__( 'Hide', 'sellkit' ),
167 'return_value' => 'yes',
168 'default' => 'yes',
169 'condition' => [
170 'layout-type' => 'multi-step',
171 ],
172 ]
173 );
174
175 $this->add_control(
176 'place_order_btn_txt',
177 [
178 'label' => esc_html__( 'Place Order Button Text', 'sellkit' ),
179 'type' => 'text',
180 'label_block' => true,
181 'default' => esc_html__( 'Complete Order', 'sellkit' ),
182 ]
183 );
184
185 $this->end_controls_section();
186 }
187
188 private function google_autocomplete_settings() {
189 if ( sellkit()->has_pro ) {
190 \Sellkit_Elementor_Checkout_Pro_Module::google_address_autocomplete( $this );
191 }
192 }
193
194 private function coupon_form_visibility() {
195 $this->start_controls_section(
196 'coupon_form_visibility',
197 [
198 'label' => esc_html__( 'Coupon', 'sellkit' ),
199 ]
200 );
201
202 $this->add_control(
203 'show_coupon_field',
204 [
205 'label' => esc_html__( 'Enable Coupon Field', 'sellkit' ),
206 'type' => 'switcher',
207 'label_on' => esc_html__( 'Yes', 'sellkit' ),
208 'label_off' => esc_html__( 'No', 'sellkit' ),
209 'return_value' => 'yes',
210 'default' => 'yes',
211 ]
212 );
213
214 $this->add_control(
215 'coupon_field_type',
216 [
217 'label' => esc_html__( 'Coupon Field Behavior', 'sellkit' ),
218 'type' => 'select',
219 'default' => 'normal',
220 'options' => [
221 'normal' => esc_html__( 'ُNormal', 'sellkit' ),
222 'collapsible' => esc_html__( 'Collapsible', 'sellkit' ),
223 ],
224 ]
225 );
226
227 $this->end_controls_section();
228 }
229
230 private function shipping_fields() {
231 $this->start_controls_section(
232 'shipping_fields',
233 [
234 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
235 ]
236 );
237
238 $repeater = new \Elementor\Repeater();
239
240 $repeater->add_control(
241 'shipping_list_field',
242 [
243 'label' => esc_html__( 'Field role', 'sellkit' ),
244 'type' => 'select',
245 'options' => $this->shipping_fields_type(),
246 ]
247 );
248
249 $repeater->add_control(
250 'shipping_custom_type',
251 [
252 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
253 'type' => 'select',
254 'options' => [
255 'text' => esc_html__( 'Text Field', 'sellkit' ),
256 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
257 'select' => esc_html__( 'Select Field', 'sellkit' ),
258 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
259 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
260 'radio' => esc_html__( 'Radio', 'sellkit' ),
261 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
262 'email' => esc_html__( 'Email Field', 'sellkit' ),
263 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
264 ],
265 'condition' => [
266 'shipping_list_field' => 'custom_role',
267 ],
268 'default' => 'text',
269 ]
270 );
271
272 $repeater->add_control(
273 'shipping_custom_options',
274 [
275 'label' => esc_html__( 'Options', 'sellkit' ),
276 'type' => 'textarea',
277 'rows' => 5,
278 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
279 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
280 'condition' => [
281 'shipping_custom_type' => [ 'select', 'multiselect', 'radio' ],
282 ],
283 ]
284 );
285
286 $repeater->add_control(
287 'shipping_radio_field_mode',
288 [
289 'label' => esc_html__( 'Display Mode', 'sellkit' ),
290 'type' => 'choose',
291 'options' => [
292 'inline' => [
293 'title' => esc_html__( 'Inline', 'sellkit' ),
294 'icon' => 'eicon-ellipsis-h',
295 ],
296 'list' => [
297 'title' => esc_html__( 'List', 'sellkit' ),
298 'icon' => 'eicon-bullet-list',
299 ],
300 ],
301 'default' => 'list',
302 'toggle' => true,
303 'condition' => [
304 'shipping_custom_type' => [ 'radio' ],
305 ],
306 ]
307 );
308
309 $repeater->add_control(
310 'shipping_custom_id',
311 [
312 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
313 'type' => 'text',
314 'placeholder' => 'e.g. my_custom_field',
315 'condition' => [
316 'shipping_list_field' => 'custom_role',
317 ],
318 ]
319 );
320
321 $repeater->add_control(
322 'shipping_custom_value',
323 [
324 'label' => esc_html__( 'Default Value', 'sellkit' ),
325 'type' => 'text',
326 'condition' => [
327 'shipping_list_field' => 'custom_role',
328 'shipping_custom_type' => [ 'text', 'textarea', 'select', 'radio', 'hidden', 'tel', 'email' ],
329 ],
330 ]
331 );
332
333 $repeater->add_control(
334 'shipping_checkbox_custom_value',
335 [
336 'label' => esc_html__( 'Default Value', 'sellkit' ),
337 'type' => 'select',
338 'options' => [
339 'true' => 'True',
340 'false' => 'False',
341 ],
342 'condition' => [
343 'shipping_list_field' => 'custom_role',
344 'shipping_custom_type' => [ 'checkbox' ],
345 ],
346 ]
347 );
348
349 $repeater->add_control(
350 'shipping_width',
351 [
352 'label' => esc_html__( 'Width', 'sellkit' ),
353 'type' => 'select',
354 'options' => [
355 'w-10' => esc_html__( '10%', 'sellkit' ),
356 'w-20' => esc_html__( '20%', 'sellkit' ),
357 'w-30' => esc_html__( '30%', 'sellkit' ),
358 'w-33' => esc_html__( '33%', 'sellkit' ),
359 'w-34' => esc_html__( '34%', 'sellkit' ),
360 'w-40' => esc_html__( '40%', 'sellkit' ),
361 'w-50' => esc_html__( '50%', 'sellkit' ),
362 'w-60' => esc_html__( '60%', 'sellkit' ),
363 'w-70' => esc_html__( '70%', 'sellkit' ),
364 'w-80' => esc_html__( '80%', 'sellkit' ),
365 'w-90' => esc_html__( '90%', 'sellkit' ),
366 'w-100' => esc_html__( '100%', 'sellkit' ),
367 ],
368 'default' => 'w-100',
369 ]
370 );
371
372 $repeater->add_control(
373 'shipping_list_placeholder',
374 [
375 'label' => esc_html__( 'Field Label', 'sellkit' ),
376 'type' => 'text',
377 'default' => esc_html__( 'Default label', 'sellkit' ),
378 ]
379 );
380
381 $repeater->add_control(
382 'shipping_list_class',
383 [
384 'label' => esc_html__( 'Field Class', 'sellkit' ),
385 'type' => 'text',
386 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
387 ]
388 );
389
390 $repeater->add_control(
391 'shipping_list_validation',
392 [
393 'label' => esc_html__( 'Validation', 'sellkit' ),
394 'type' => 'select',
395 'options' => [
396 '' => esc_html__( 'Select one...', 'sellkit' ),
397 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
398 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
399 ],
400 'default' => '',
401 'condition' => [
402 'shipping_custom_type' => [ 'text', 'select', 'tel' ],
403 ],
404 ]
405 );
406
407 $repeater->add_control(
408 'shipping_list_required',
409 [
410 'label' => esc_html__( 'Field Required?', 'sellkit' ),
411 'type' => 'select',
412 'options' => [
413 'yes' => esc_html__( 'Yes', 'sellkit' ),
414 'no' => esc_html__( 'No', 'sellkit' ),
415 ],
416 'default' => 'no',
417 ]
418 );
419
420 $repeater->add_control(
421 'shipping_list_clear',
422 [
423 'label' => esc_html__( 'Field Clear', 'sellkit' ),
424 'type' => 'select',
425 'description' => 'Applies a clear fix to the field',
426 'options' => [
427 'yes' => esc_html__( 'Yes', 'sellkit' ),
428 'no' => esc_html__( 'No', 'sellkit' ),
429 ],
430 'default' => 'no',
431 ]
432 );
433
434 $repeater->add_control(
435 'shipping_show_in_thankyou',
436 [
437 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
438 'type' => 'switcher',
439 'label_on' => esc_html__( 'Show', 'sellkit' ),
440 'label_off' => esc_html__( 'Hide', 'sellkit' ),
441 'return_value' => 'yes',
442 'default' => 'no',
443 'condition' => [
444 'shipping_list_field' => 'custom_role',
445 ],
446 ]
447 );
448
449 $repeater->add_control(
450 'shipping_show_in_order_mail',
451 [
452 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
453 'type' => 'switcher',
454 'label_on' => esc_html__( 'Show', 'sellkit' ),
455 'label_off' => esc_html__( 'Hide', 'sellkit' ),
456 'return_value' => 'yes',
457 'default' => 'no',
458 'condition' => [
459 'shipping_list_field' => 'custom_role',
460 ],
461 ]
462 );
463
464 $this->add_control(
465 'shipping_list',
466 [
467 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
468 'type' => 'repeater',
469 'fields' => $repeater->get_controls(),
470 'item_actions' => [
471 'duplicate' => false,
472 ],
473 'prevent_empty' => false,
474 'default' => [
475 [
476 'shipping_list_field' => 'shipping_first_name',
477 'shipping_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
478 'shipping_width' => 'w-50',
479 'shipping_list_required' => 'yes',
480 'shipping_list_clear' => 'no',
481 ],
482 [
483 'shipping_list_field' => 'shipping_last_name',
484 'shipping_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
485 'shipping_width' => 'w-50',
486 'shipping_list_required' => 'no',
487 'shipping_list_clear' => 'no',
488 ],
489 [
490 'shipping_list_field' => 'shipping_address_1',
491 'shipping_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
492 'shipping_width' => 'w-100',
493 'shipping_list_required' => 'no',
494 'shipping_list_clear' => 'no',
495 ],
496 [
497 'shipping_list_field' => 'shipping_address_2',
498 'shipping_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
499 'shipping_width' => 'w-100',
500 'shipping_list_required' => 'no',
501 'shipping_list_clear' => 'no',
502 ],
503 [
504 'shipping_list_field' => 'shipping_country',
505 'shipping_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
506 'shipping_width' => 'w-33',
507 'shipping_list_required' => 'no',
508 'shipping_list_clear' => 'no',
509 ],
510 [
511 'shipping_list_field' => 'shipping_state',
512 'shipping_list_placeholder' => esc_html__( 'State', 'sellkit' ),
513 'shipping_width' => 'w-33',
514 'shipping_list_required' => 'no',
515 'shipping_list_clear' => 'no',
516 ],
517 [
518 'shipping_list_field' => 'shipping_postcode',
519 'shipping_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
520 'shipping_width' => 'w-34',
521 'shipping_list_required' => 'no',
522 'shipping_list_clear' => 'no',
523 ],
524 [
525 'shipping_list_field' => 'shipping_city',
526 'shipping_list_placeholder' => esc_html__( 'City', 'sellkit' ),
527 'shipping_width' => 'w-100',
528 'shipping_list_required' => 'no',
529 'shipping_list_clear' => 'no',
530 ],
531 ],
532 'title_field' => '{{{ shipping_list_field }}}',
533 ]
534 );
535
536 $this->end_controls_section();
537 }
538
539 public function billing_fields() {
540 $this->start_controls_section(
541 'billing_fields',
542 [
543 'label' => esc_html__( 'Billings Fields', 'sellkit' ),
544 ]
545 );
546
547 $repeater = new \Elementor\Repeater();
548
549 /* Prevent user to add email field , we added that at login form. billing_email excluded. */
550 $repeater->add_control(
551 'billing_list_field',
552 [
553 'label' => esc_html__( 'Field role', 'sellkit' ),
554 'type' => 'select',
555 'options' => $this->billing_fields_type(),
556 ]
557 );
558
559 $repeater->add_control(
560 'billing_custom_type',
561 [
562 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
563 'type' => 'select',
564 'options' => [
565 'text' => esc_html__( 'Text Field', 'sellkit' ),
566 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
567 'select' => esc_html__( 'Select Field', 'sellkit' ),
568 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
569 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
570 'radio' => esc_html__( 'Radio', 'sellkit' ),
571 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
572 'email' => esc_html__( 'Email Field', 'sellkit' ),
573 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
574 ],
575 'condition' => [
576 'billing_list_field' => 'custom_role',
577 ],
578 'default' => 'text',
579 ]
580 );
581
582 $repeater->add_control(
583 'billing_custom_options',
584 [
585 'label' => esc_html__( 'Options', 'sellkit' ),
586 'type' => 'textarea',
587 'rows' => 5,
588 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
589 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
590 'condition' => [
591 'billing_custom_type' => [ 'select', 'multiselect', 'radio' ],
592 ],
593 ]
594 );
595
596 $repeater->add_control(
597 'billing_radio_field_mode',
598 [
599 'label' => esc_html__( 'Display Mode', 'sellkit' ),
600 'type' => 'choose',
601 'options' => [
602 'inline' => [
603 'title' => esc_html__( 'Inline', 'sellkit' ),
604 'icon' => 'eicon-ellipsis-h',
605 ],
606 'list' => [
607 'title' => esc_html__( 'List', 'sellkit' ),
608 'icon' => 'eicon-bullet-list',
609 ],
610 ],
611 'default' => 'list',
612 'toggle' => true,
613 'condition' => [
614 'billing_custom_type' => [ 'radio' ],
615 ],
616 ]
617 );
618
619 $repeater->add_control(
620 'billing_custom_id',
621 [
622 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
623 'type' => 'text',
624 'placeholder' => 'e.g. my_custom_field',
625 'condition' => [
626 'billing_list_field' => 'custom_role',
627 ],
628 ]
629 );
630
631 $repeater->add_control(
632 'billing_custom_value',
633 [
634 'label' => esc_html__( 'Default Value', 'sellkit' ),
635 'type' => 'text',
636 'condition' => [
637 'billing_list_field' => 'custom_role',
638 'billing_custom_type' => [ 'text', 'textarea', 'select', 'multiselect', 'radio', 'tel', 'email', 'hidden' ],
639 ],
640 ]
641 );
642
643 $repeater->add_control(
644 'billing_checkbox_custom_value',
645 [
646 'label' => esc_html__( 'Default Value', 'sellkit' ),
647 'type' => 'select',
648 'options' => [
649 'true' => 'True',
650 'false' => 'False',
651 ],
652 'condition' => [
653 'billing_list_field' => 'custom_role',
654 'billing_custom_type' => [ 'checkbox' ],
655 ],
656 ]
657 );
658
659 $repeater->add_control(
660 'billing_width',
661 [
662 'label' => esc_html__( 'Width', 'sellkit' ),
663 'type' => 'select',
664 'options' => [
665 'w-10' => esc_html__( '10%', 'sellkit' ),
666 'w-20' => esc_html__( '20%', 'sellkit' ),
667 'w-30' => esc_html__( '30%', 'sellkit' ),
668 'w-33' => esc_html__( '33%', 'sellkit' ),
669 'w-34' => esc_html__( '34%', 'sellkit' ),
670 'w-40' => esc_html__( '40%', 'sellkit' ),
671 'w-50' => esc_html__( '50%', 'sellkit' ),
672 'w-60' => esc_html__( '60%', 'sellkit' ),
673 'w-70' => esc_html__( '70%', 'sellkit' ),
674 'w-80' => esc_html__( '80%', 'sellkit' ),
675 'w-90' => esc_html__( '90%', 'sellkit' ),
676 'w-100' => esc_html__( '100%', 'sellkit' ),
677 ],
678 'default' => 'w-100',
679 ]
680 );
681
682 $repeater->add_control(
683 'billing_list_placeholder',
684 [
685 'label' => esc_html__( 'Field Label', 'sellkit' ),
686 'type' => 'text',
687 'default' => esc_html__( 'Default label', 'sellkit' ),
688 ]
689 );
690
691 $repeater->add_control(
692 'billing_list_class',
693 [
694 'label' => esc_html__( 'Field Class', 'sellkit' ),
695 'type' => 'text',
696 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
697 ]
698 );
699
700 $repeater->add_control(
701 'billing_list_validation',
702 [
703 'label' => esc_html__( 'Validation', 'sellkit' ),
704 'type' => 'select',
705 'options' => [
706 '' => esc_html__( 'Select one...', 'sellkit' ),
707 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
708 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
709 ],
710 'default' => '',
711 'condition' => [
712 'billing_custom_type' => [ 'text', 'select', 'tel' ],
713 ],
714 ]
715 );
716
717 $repeater->add_control(
718 'billing_list_required',
719 [
720 'label' => esc_html__( 'Field Required?', 'sellkit' ),
721 'type' => 'select',
722 'options' => [
723 'yes' => esc_html__( 'Yes', 'sellkit' ),
724 'no' => esc_html__( 'No', 'sellkit' ),
725 ],
726 'default' => 'no',
727 ]
728 );
729
730 $repeater->add_control(
731 'billing_list_clear',
732 [
733 'label' => esc_html__( 'Field Clear', 'sellkit' ),
734 'type' => 'select',
735 'description' => esc_html__( 'Yes or No, applies a clear fix to the field', 'sellkit' ),
736 'options' => [
737 'yes' => esc_html__( 'Yes', 'sellkit' ),
738 'no' => esc_html__( 'No', 'sellkit' ),
739 ],
740 'default' => 'no',
741 ]
742 );
743
744 $repeater->add_control(
745 'billing_show_in_thankyou',
746 [
747 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
748 'type' => 'switcher',
749 'label_on' => esc_html__( 'Show', 'sellkit' ),
750 'label_off' => esc_html__( 'Hide', 'sellkit' ),
751 'return_value' => 'yes',
752 'default' => 'no',
753 'condition' => [
754 'billing_list_field' => 'custom_role',
755 ],
756 ]
757 );
758
759 $repeater->add_control(
760 'billing_show_in_order_mail',
761 [
762 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
763 'type' => 'switcher',
764 'label_on' => esc_html__( 'Show', 'sellkit' ),
765 'label_off' => esc_html__( 'Hide', 'sellkit' ),
766 'return_value' => 'yes',
767 'default' => 'no',
768 'condition' => [
769 'billing_list_field' => 'custom_role',
770 ],
771 ]
772 );
773
774 $this->add_control(
775 'billing_list',
776 [
777 'label' => esc_html__( 'Billing Fields', 'sellkit' ),
778 'type' => 'repeater',
779 'fields' => $repeater->get_controls(),
780 'item_actions' => [
781 'duplicate' => false,
782 ],
783 'prevent_empty' => false,
784 'default' => [
785 [
786 'billing_list_field' => 'billing_first_name',
787 'billing_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
788 'billing_width' => 'w-50',
789 'billing_list_required' => 'yes',
790 'billing_list_clear' => 'no',
791 ],
792 [
793 'billing_list_field' => 'billing_last_name',
794 'billing_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
795 'billing_width' => 'w-50',
796 'billing_list_required' => 'no',
797 'billing_list_clear' => 'no',
798 ],
799 [
800 'billing_list_field' => 'billing_address_1',
801 'billing_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
802 'billing_width' => 'w-100',
803 'billing_list_required' => 'no',
804 'billing_list_clear' => 'no',
805 ],
806 [
807 'billing_list_field' => 'billing_address_2',
808 'billing_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
809 'billing_width' => 'w-100',
810 'billing_list_required' => 'no',
811 'billing_list_clear' => 'no',
812 ],
813 [
814 'billing_list_field' => 'billing_country',
815 'billing_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
816 'billing_width' => 'w-33',
817 'billing_list_required' => 'no',
818 'billing_list_clear' => 'no',
819 ],
820 [
821 'billing_list_field' => 'billing_state',
822 'billing_list_placeholder' => esc_html__( 'State', 'sellkit' ),
823 'billing_width' => 'w-33',
824 'billing_list_required' => 'no',
825 'billing_list_clear' => 'no',
826 ],
827 [
828 'billing_list_field' => 'billing_postcode',
829 'billing_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
830 'billing_width' => 'w-34',
831 'billing_list_required' => 'no',
832 'billing_list_clear' => 'no',
833 ],
834 [
835 'billing_list_field' => 'billing_city',
836 'billing_list_placeholder' => esc_html__( 'City', 'sellkit' ),
837 'billing_width' => 'w-100',
838 'billing_list_required' => 'no',
839 'billing_list_clear' => 'no',
840 ],
841 ],
842 'title_field' => '{{{ billing_list_field }}}',
843 ]
844 );
845
846 $this->end_controls_section();
847 }
848
849 private function custom_messages() {
850 $this->start_controls_section(
851 'custom_messages',
852 [
853 'label' => esc_html__( 'Custom Messages', 'sellkit' ),
854 ]
855 );
856
857 $this->add_control(
858 'empty_cart',
859 [
860 'type' => 'text',
861 'default' => esc_html__( 'Your shopping cart is empty.', 'sellkit' ),
862 'label_block' => true,
863 ]
864 );
865
866 $this->add_control(
867 'create_website_account',
868 [
869 'type' => 'text',
870 'default' => esc_html__( 'Create a {{website}} account', 'sellkit' ),
871 'label_block' => true,
872 'description' => '{{website}} will automatically point to your website name',
873 ]
874 );
875
876 $this->add_control(
877 'secure_transaction_text',
878 [
879 'type' => 'text',
880 'default' => esc_html__( 'All transactions are secure and encrypted.', 'sellkit' ),
881 'label_block' => true,
882 ]
883 );
884
885 $this->add_control(
886 'select_address_text',
887 [
888 'type' => 'text',
889 'default' => esc_html__( 'Select the address that matches your card or payment method.', 'sellkit' ),
890 'label_block' => true,
891 ]
892 );
893
894 $this->end_controls_section();
895 }
896 }
897