PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.1.4
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.1.4
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.1.4, at includes/elementor/modules/checkout/widgets/settings-controls.php

889 lines 25.0 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__( 'Select 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 ]
402 );
403
404 $repeater->add_control(
405 'shipping_list_required',
406 [
407 'label' => esc_html__( 'Field Required?', 'sellkit' ),
408 'type' => 'select',
409 'options' => [
410 'yes' => esc_html__( 'Yes', 'sellkit' ),
411 'no' => esc_html__( 'No', 'sellkit' ),
412 ],
413 'default' => 'no',
414 ]
415 );
416
417 $repeater->add_control(
418 'shipping_list_clear',
419 [
420 'label' => esc_html__( 'Field Clear', 'sellkit' ),
421 'type' => 'select',
422 'description' => 'Applies a clear fix to the field',
423 'options' => [
424 'yes' => esc_html__( 'Yes', 'sellkit' ),
425 'no' => esc_html__( 'No', 'sellkit' ),
426 ],
427 'default' => 'no',
428 ]
429 );
430
431 $repeater->add_control(
432 'shipping_show_in_thankyou',
433 [
434 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
435 'type' => 'switcher',
436 'label_on' => esc_html__( 'Show', 'sellkit' ),
437 'label_off' => esc_html__( 'Hide', 'sellkit' ),
438 'return_value' => 'yes',
439 'default' => 'no',
440 'condition' => [
441 'shipping_list_field' => 'custom_role',
442 ],
443 ]
444 );
445
446 $repeater->add_control(
447 'shipping_show_in_order_mail',
448 [
449 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
450 'type' => 'switcher',
451 'label_on' => esc_html__( 'Show', 'sellkit' ),
452 'label_off' => esc_html__( 'Hide', 'sellkit' ),
453 'return_value' => 'yes',
454 'default' => 'no',
455 'condition' => [
456 'shipping_list_field' => 'custom_role',
457 ],
458 ]
459 );
460
461 $this->add_control(
462 'shipping_list',
463 [
464 'label' => esc_html__( 'Shipping Fields', 'sellkit' ),
465 'type' => 'repeater',
466 'fields' => $repeater->get_controls(),
467 'item_actions' => [
468 'duplicate' => false,
469 ],
470 'default' => [
471 [
472 'shipping_list_field' => 'shipping_first_name',
473 'shipping_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
474 'shipping_width' => 'w-50',
475 'shipping_list_required' => 'yes',
476 'shipping_list_clear' => 'no',
477 ],
478 [
479 'shipping_list_field' => 'shipping_last_name',
480 'shipping_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
481 'shipping_width' => 'w-50',
482 'shipping_list_required' => 'no',
483 'shipping_list_clear' => 'no',
484 ],
485 [
486 'shipping_list_field' => 'shipping_address_1',
487 'shipping_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
488 'shipping_width' => 'w-100',
489 'shipping_list_required' => 'no',
490 'shipping_list_clear' => 'no',
491 ],
492 [
493 'shipping_list_field' => 'shipping_address_2',
494 'shipping_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
495 'shipping_width' => 'w-100',
496 'shipping_list_required' => 'no',
497 'shipping_list_clear' => 'no',
498 ],
499 [
500 'shipping_list_field' => 'shipping_country',
501 'shipping_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
502 'shipping_width' => 'w-33',
503 'shipping_list_required' => 'no',
504 'shipping_list_clear' => 'no',
505 ],
506 [
507 'shipping_list_field' => 'shipping_state',
508 'shipping_list_placeholder' => esc_html__( 'State', 'sellkit' ),
509 'shipping_width' => 'w-33',
510 'shipping_list_required' => 'no',
511 'shipping_list_clear' => 'no',
512 ],
513 [
514 'shipping_list_field' => 'shipping_postcode',
515 'shipping_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
516 'shipping_width' => 'w-34',
517 'shipping_list_required' => 'no',
518 'shipping_list_clear' => 'no',
519 ],
520 [
521 'shipping_list_field' => 'shipping_city',
522 'shipping_list_placeholder' => esc_html__( 'City', 'sellkit' ),
523 'shipping_width' => 'w-100',
524 'shipping_list_required' => 'no',
525 'shipping_list_clear' => 'no',
526 ],
527 ],
528 'title_field' => '{{{ shipping_list_field }}}',
529 ]
530 );
531
532 $this->end_controls_section();
533 }
534
535 public function billing_fields() {
536 $this->start_controls_section(
537 'billing_fields',
538 [
539 'label' => esc_html__( 'Billings Fields', 'sellkit' ),
540 ]
541 );
542
543 $repeater = new \Elementor\Repeater();
544
545 /* Prevent user to add email field , we added that at login form. billing_email excluded. */
546 $repeater->add_control(
547 'billing_list_field',
548 [
549 'label' => esc_html__( 'Select Field role', 'sellkit' ),
550 'type' => 'select',
551 'options' => $this->billing_fields_type(),
552 ]
553 );
554
555 $repeater->add_control(
556 'billing_custom_type',
557 [
558 'label' => esc_html__( 'Custom Field Type', 'sellkit' ),
559 'type' => 'select',
560 'options' => [
561 'text' => esc_html__( 'Text Field', 'sellkit' ),
562 'textarea' => esc_html__( 'Textarea Field', 'sellkit' ),
563 'select' => esc_html__( 'Select Field', 'sellkit' ),
564 'multiselect' => esc_html__( 'Multiselect Field', 'sellkit' ),
565 'checkbox' => esc_html__( 'Checkbox', 'sellkit' ),
566 'radio' => esc_html__( 'Radio', 'sellkit' ),
567 'tel' => esc_html__( 'Tel Field', 'sellkit' ),
568 'email' => esc_html__( 'Email Field', 'sellkit' ),
569 'hidden' => esc_html__( 'Hidden Field', 'sellkit' ),
570 ],
571 'condition' => [
572 'billing_list_field' => 'custom_role',
573 ],
574 'default' => 'text',
575 ]
576 );
577
578 $repeater->add_control(
579 'billing_custom_options',
580 [
581 'label' => esc_html__( 'Options', 'sellkit' ),
582 'type' => 'textarea',
583 'rows' => 5,
584 'placeholder' => esc_html__( 'e.g. option1:label1', 'sellkit' ),
585 'description' => esc_html__( 'Each line one option and separate value and label with (:)', 'sellkit' ),
586 'condition' => [
587 'billing_custom_type' => [ 'select', 'multiselect', 'radio' ],
588 ],
589 ]
590 );
591
592 $repeater->add_control(
593 'billing_radio_field_mode',
594 [
595 'label' => esc_html__( 'Display Mode', 'sellkit' ),
596 'type' => 'choose',
597 'options' => [
598 'inline' => [
599 'title' => esc_html__( 'Inline', 'sellkit' ),
600 'icon' => 'eicon-ellipsis-h',
601 ],
602 'list' => [
603 'title' => esc_html__( 'List', 'sellkit' ),
604 'icon' => 'eicon-bullet-list',
605 ],
606 ],
607 'default' => 'list',
608 'toggle' => true,
609 'condition' => [
610 'billing_custom_type' => [ 'radio' ],
611 ],
612 ]
613 );
614
615 $repeater->add_control(
616 'billing_custom_id',
617 [
618 'label' => esc_html__( 'Custom Field ID', 'sellkit' ),
619 'type' => 'text',
620 'placeholder' => 'e.g. my_custom_field',
621 'condition' => [
622 'billing_list_field' => 'custom_role',
623 ],
624 ]
625 );
626
627 $repeater->add_control(
628 'billing_custom_value',
629 [
630 'label' => esc_html__( 'Default Value', 'sellkit' ),
631 'type' => 'text',
632 'condition' => [
633 'billing_list_field' => 'custom_role',
634 'billing_custom_type' => [ 'text', 'textarea', 'select', 'multiselect', 'radio', 'tel', 'email', 'hidden' ],
635 ],
636 ]
637 );
638
639 $repeater->add_control(
640 'billing_checkbox_custom_value',
641 [
642 'label' => esc_html__( 'Default Value', 'sellkit' ),
643 'type' => 'select',
644 'options' => [
645 'true' => 'True',
646 'false' => 'False',
647 ],
648 'condition' => [
649 'billing_list_field' => 'custom_role',
650 'billing_custom_type' => [ 'checkbox' ],
651 ],
652 ]
653 );
654
655 $repeater->add_control(
656 'billing_width',
657 [
658 'label' => esc_html__( 'Width', 'sellkit' ),
659 'type' => 'select',
660 'options' => [
661 'w-10' => esc_html__( '10%', 'sellkit' ),
662 'w-20' => esc_html__( '20%', 'sellkit' ),
663 'w-30' => esc_html__( '30%', 'sellkit' ),
664 'w-33' => esc_html__( '33%', 'sellkit' ),
665 'w-34' => esc_html__( '34%', 'sellkit' ),
666 'w-40' => esc_html__( '40%', 'sellkit' ),
667 'w-50' => esc_html__( '50%', 'sellkit' ),
668 'w-60' => esc_html__( '60%', 'sellkit' ),
669 'w-70' => esc_html__( '70%', 'sellkit' ),
670 'w-80' => esc_html__( '80%', 'sellkit' ),
671 'w-90' => esc_html__( '90%', 'sellkit' ),
672 'w-100' => esc_html__( '100%', 'sellkit' ),
673 ],
674 'default' => 'w-100',
675 ]
676 );
677
678 $repeater->add_control(
679 'billing_list_placeholder',
680 [
681 'label' => esc_html__( 'Field Label', 'sellkit' ),
682 'type' => 'text',
683 'default' => esc_html__( 'Default label', 'sellkit' ),
684 ]
685 );
686
687 $repeater->add_control(
688 'billing_list_class',
689 [
690 'label' => esc_html__( 'Field Class', 'sellkit' ),
691 'type' => 'text',
692 'description' => esc_html__( 'Divide each class with space character', 'sellkit' ),
693 ]
694 );
695
696 $repeater->add_control(
697 'billing_list_validation',
698 [
699 'label' => esc_html__( 'Validation', 'sellkit' ),
700 'type' => 'select',
701 'options' => [
702 '' => esc_html__( 'Select one...', 'sellkit' ),
703 'phone' => esc_html__( 'Phone validation', 'sellkit' ),
704 'postcode' => esc_html__( 'Postcode Validation', 'sellkit' ),
705 ],
706 'default' => '',
707 ]
708 );
709
710 $repeater->add_control(
711 'billing_list_required',
712 [
713 'label' => esc_html__( 'Field Required?', 'sellkit' ),
714 'type' => 'select',
715 'options' => [
716 'yes' => esc_html__( 'Yes', 'sellkit' ),
717 'no' => esc_html__( 'No', 'sellkit' ),
718 ],
719 'default' => 'no',
720 ]
721 );
722
723 $repeater->add_control(
724 'billing_list_clear',
725 [
726 'label' => esc_html__( 'Field Clear', 'sellkit' ),
727 'type' => 'select',
728 'description' => esc_html__( 'Yes or No, applies a clear fix to the field', 'sellkit' ),
729 'options' => [
730 'yes' => esc_html__( 'Yes', 'sellkit' ),
731 'no' => esc_html__( 'No', 'sellkit' ),
732 ],
733 'default' => 'no',
734 ]
735 );
736
737 $repeater->add_control(
738 'billing_show_in_thankyou',
739 [
740 'label' => esc_html__( 'Show in Thank You Page', 'sellkit' ),
741 'type' => 'switcher',
742 'label_on' => esc_html__( 'Show', 'sellkit' ),
743 'label_off' => esc_html__( 'Hide', 'sellkit' ),
744 'return_value' => 'yes',
745 'default' => 'no',
746 'condition' => [
747 'billing_list_field' => 'custom_role',
748 ],
749 ]
750 );
751
752 $repeater->add_control(
753 'billing_show_in_order_mail',
754 [
755 'label' => esc_html__( 'Show in Order Email', 'sellkit' ),
756 'type' => 'switcher',
757 'label_on' => esc_html__( 'Show', 'sellkit' ),
758 'label_off' => esc_html__( 'Hide', 'sellkit' ),
759 'return_value' => 'yes',
760 'default' => 'no',
761 'condition' => [
762 'billing_list_field' => 'custom_role',
763 ],
764 ]
765 );
766
767 $this->add_control(
768 'billing_list',
769 [
770 'label' => esc_html__( 'Billing Fields', 'sellkit' ),
771 'type' => 'repeater',
772 'fields' => $repeater->get_controls(),
773 'item_actions' => [
774 'duplicate' => false,
775 ],
776 'default' => [
777 [
778 'billing_list_field' => 'billing_first_name',
779 'billing_list_placeholder' => esc_html__( 'First Name', 'sellkit' ),
780 'billing_width' => 'w-50',
781 'billing_list_required' => 'yes',
782 'billing_list_clear' => 'no',
783 ],
784 [
785 'billing_list_field' => 'billing_last_name',
786 'billing_list_placeholder' => esc_html__( 'Last Name', 'sellkit' ),
787 'billing_width' => 'w-50',
788 'billing_list_required' => 'no',
789 'billing_list_clear' => 'no',
790 ],
791 [
792 'billing_list_field' => 'billing_address_1',
793 'billing_list_placeholder' => esc_html__( 'Address', 'sellkit' ),
794 'billing_width' => 'w-100',
795 'billing_list_required' => 'no',
796 'billing_list_clear' => 'no',
797 ],
798 [
799 'billing_list_field' => 'billing_address_2',
800 'billing_list_placeholder' => esc_html__( 'apartment, suit, unit, etc.', 'sellkit' ),
801 'billing_width' => 'w-100',
802 'billing_list_required' => 'no',
803 'billing_list_clear' => 'no',
804 ],
805 [
806 'billing_list_field' => 'billing_country',
807 'billing_list_placeholder' => esc_html__( 'Country', 'sellkit' ),
808 'billing_width' => 'w-33',
809 'billing_list_required' => 'no',
810 'billing_list_clear' => 'no',
811 ],
812 [
813 'billing_list_field' => 'billing_state',
814 'billing_list_placeholder' => esc_html__( 'State', 'sellkit' ),
815 'billing_width' => 'w-33',
816 'billing_list_required' => 'no',
817 'billing_list_clear' => 'no',
818 ],
819 [
820 'billing_list_field' => 'billing_postcode',
821 'billing_list_placeholder' => esc_html__( 'Postal code', 'sellkit' ),
822 'billing_width' => 'w-34',
823 'billing_list_required' => 'no',
824 'billing_list_clear' => 'no',
825 ],
826 [
827 'billing_list_field' => 'billing_city',
828 'billing_list_placeholder' => esc_html__( 'City', 'sellkit' ),
829 'billing_width' => 'w-100',
830 'billing_list_required' => 'no',
831 'billing_list_clear' => 'no',
832 ],
833 ],
834 'title_field' => '{{{ billing_list_field }}}',
835 ]
836 );
837
838 $this->end_controls_section();
839 }
840
841 private function custom_messages() {
842 $this->start_controls_section(
843 'custom_messages',
844 [
845 'label' => esc_html__( 'Custom Messages', 'sellkit' ),
846 ]
847 );
848
849 $this->add_control(
850 'empty_cart',
851 [
852 'type' => 'text',
853 'default' => esc_html__( 'Your shopping cart is empty.', 'sellkit' ),
854 'label_block' => true,
855 ]
856 );
857
858 $this->add_control(
859 'create_website_account',
860 [
861 'type' => 'text',
862 'default' => esc_html__( 'Create a {{website}} account', 'sellkit' ),
863 'label_block' => true,
864 'description' => '{{website}} will automatically point to your website name',
865 ]
866 );
867
868 $this->add_control(
869 'secure_transaction_text',
870 [
871 'type' => 'text',
872 'default' => esc_html__( 'All transactions are secure and encrypted.', 'sellkit' ),
873 'label_block' => true,
874 ]
875 );
876
877 $this->add_control(
878 'select_address_text',
879 [
880 'type' => 'text',
881 'default' => esc_html__( 'Select the address that matches your card or payment method.', 'sellkit' ),
882 'label_block' => true,
883 ]
884 );
885
886 $this->end_controls_section();
887 }
888 }
889