PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.1.1
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.1.1
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / modules / bricks / elements / class-cartflows-bricks-checkout-form.php

class-cartflows-bricks-checkout-form.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.1.1, at modules/bricks/elements/class-cartflows-bricks-checkout-form.php

1,271 lines 41.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bricks theme compatibility
4 *
5 * @package CartFlows
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 /**
13 * Class for Bricks theme compatibility
14 */
15 class Cartflows_Bricks_Checkout_Form extends \Bricks\Element {
16 /**
17 * Category of the element.
18 *
19 * @var instance
20 */
21 public $category = 'CartFlows';
22
23 /**
24 * Name of the element.
25 *
26 * @var instance
27 */
28
29 public $name = 'bricks-checkout-form';
30
31 /**
32 * Icon of the element.
33 *
34 * @var instance
35 */
36 public $icon = 'fa-solid fa-cart-shopping';
37
38 /**
39 * Label of the element.
40 *
41 * @var instance
42 */
43 public function get_label() {
44 return esc_html__( 'Checkout Form', 'cartflows' );
45 }
46
47 /**
48 * Function to get layout types.
49 *
50 * @since 1.6.15
51 * @access protected
52 */
53 protected function get_layout_types() {
54
55 $layout_options = array();
56
57 if ( ! _is_cartflows_pro() ) {
58 $layout_options = array(
59 'modern-checkout' => __( 'Modern Checkout', 'cartflows' ),
60 'modern-one-column' => esc_html__( 'Modern One Column', 'cartflows' ),
61 'one-column' => esc_html__( 'One Column', 'cartflows' ),
62 'two-column' => esc_html__( 'Two Column', 'cartflows' ),
63 'two-step' => esc_html__( 'Two Step ( PRO )', 'cartflows' ),
64 'multistep-checkout' => esc_html__( 'MultiStep Checkout ( PRO )', 'cartflows' ),
65 );
66 } else {
67 $layout_options = array(
68 'modern-checkout' => esc_html__( 'Modern Checkout', 'cartflows' ),
69 'modern-one-column' => esc_html__( 'Modern One Column', 'cartflows' ),
70 'one-column' => esc_html__( 'One Column', 'cartflows' ),
71 'two-column' => esc_html__( 'Two Column', 'cartflows' ),
72 'two-step' => esc_html__( 'Two Step', 'cartflows' ),
73 'multistep-checkout' => esc_html__( 'MultiStep Checkout', 'cartflows' ),
74 );
75 }
76
77 return $layout_options;
78 }
79
80 /**
81 * Global GCP Primary Theme Color
82 *
83 * @access public
84 *
85 * @var string $gcp_primary_theme_color Primary Color.
86 * @return string $gcp_primary_theme_color Primary Color.
87 */
88 public static $gcp_primary_theme_color = '';
89
90
91 /**
92 * Global Primary Text Color
93 *
94 * @var string string $gcp_primary_text_color Primary Text Color.
95 * @return string $gcp_primary_text_color Primary Text Color.
96 */
97 public static $gcp_primary_text_color = '';
98
99 /**
100 * Global Secondary Color
101 *
102 * @var string $gcp_secondary_theme_color Secondary Color.
103 * @return string $gcp_secondary_theme_color Secondary Color.
104 */
105 public static $gcp_secondary_theme_color = '';
106
107
108 /**
109 * Register General Controls.
110 *
111 * @since 1.6.15
112 * @access protected
113 */
114 protected function register_general_content_controls() {
115
116 $this->controls['layout'] = array(
117 'label' => __( 'Layout', 'cartflows' ),
118 'type' => 'select',
119 'default' => 'modern-checkout',
120 'options' => $this->get_layout_types(),
121 'tab' => 'content',
122 'reload' => true,
123 'reloadScripts' => true,
124 );
125
126 if ( ! _is_cartflows_pro() ) {
127
128 $this->controls['layout_upgrade_pro'] = array(
129
130 'type' => 'raw',
131 /* translators: %s admin link */
132 'label' => sprintf(
133 /* translators: %s is the URL for upgrading */
134 __( 'This feature is available in the CartFlows higher plan. <a href="%1$s" target="_blank" rel="noopener">%2$s</a>.', 'cartflows' ),
135 esc_url( CARTFLOWS_DOMAIN_URL ),
136 __( 'Upgrade Now!', 'cartflows' )
137 ),
138 'required' => array( 'layout', '=', array( 'multistep-checkout', 'two-step' ) ),
139 'tab' => 'content',
140
141 );
142 }
143 }
144
145 /**
146 * Register General Style Controls.
147 *
148 * @since 1.6.15
149 * @access protected
150 */
151 protected function register_global_style_controls() {
152
153 $this->controls['global_typography'] = array(
154 'label' => esc_html__( ' Global Text Typography', 'cartflows' ),
155 'type' => 'typography',
156 'tab' => 'style',
157 'group' => 'section_general_style_fields',
158 'css' => array(
159 array(
160 'property' => 'font',
161 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce a',
162 ),
163 array(
164 'property' => 'font',
165 'selector' => '.wcf-embed-checkout-form',
166 ),
167 array(
168 'property' => 'font',
169 'selector' => '.wcf-embed-checkout-form p',
170 ),
171 array(
172 'property' => 'font',
173 'selector' => '.wcf-embed-checkout-form .woocommerce-checkout .woocommerce-privacy-policy-text p',
174 ),
175 array(
176 'property' => 'font',
177 'selector' => '.wcf-embed-checkout-form .woocommerce-checkout #payment .payment_methods a',
178 ),
179 array(
180 'property' => 'font',
181 'selector' => '.wcf-embed-checkout-form span:not( .optional )',
182 ),
183 array(
184 'property' => 'font',
185 'selector' => '.wcf-embed-checkout-form .woocommerce form .form-row input.input-text:focus',
186 ),
187 array(
188 'property' => 'font',
189 'selector' => '.wcf-embed-checkout-form .woocommerce form .form-row textarea:focus',
190 ),
191 array(
192 'property' => 'font',
193 'selector' => '.wcf-embed-checkout-form .woocommerce #order_review .wcf-custom-coupon-field input.input-text:focus',
194 ),
195 array(
196 'property' => 'font',
197 'selector' => '.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps .step-one.wcf-current:before',
198 ),
199 array(
200 'property' => 'font',
201 'selector' => '.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps .step-two.wcf-current:before',
202 ),
203 array(
204 'property' => 'font',
205 'selector' => '.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-note:before',
206 ),
207 array(
208 'property' => 'font',
209 'selector' => '.wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
210 ),
211 array(
212 'property' => 'font',
213 'selector' => '.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-note',
214 ),
215 array(
216 'property' => 'font',
217 'selector' => '.wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
218 ),
219 array(
220 'property' => 'font',
221 'selector' => '.wcf-embed-checkout-form .woocommerce #order_review button',
222 ),
223 array(
224 'property' => 'font',
225 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
226 ),
227 array(
228 'property' => 'font',
229 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form label',
230 ),
231 array(
232 'property' => 'font',
233 'selector' => '.wcf-embed-checkout-form .woocommerce #payment [type="radio"]:checked + label, .wcf-embed-checkout-form .woocommerce #payment [type="radio"]:not( :checked ) + label',
234 ),
235 array(
236 'property' => 'font',
237 'selector' => '.wcf-embed-checkout-form .woocommerce #shipping_method [type="radio"]:checked + label, .wcf-embed-checkout-form .woocommerce #shipping_method [type="radio"]:not( :checked ) + label',
238 ),
239 array(
240 'property' => 'font',
241 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .wcf-logged-in-customer-info',
242 ),
243 array(
244 'property' => 'font',
245 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form h3',
246 ),
247
248 ),
249 );
250
251 $this->controls['global_primary_color'] = array(
252 'label' => esc_html__( ' Global Primary Color', 'cartflows' ),
253 'type' => 'color',
254 'tab' => 'style',
255 'group' => 'section_general_style_fields',
256 'css' => array(
257 array(
258 'property' => 'background-color',
259 'selector' => '.wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
260 ),
261
262 array(
263 'property' => 'background-color',
264 'selector' => '.wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
265 ),
266 array(
267 'property' => 'background-color',
268 'selector' => '.wcf-embed-checkout-form .woocommerce #order_review button',
269 ),
270 array(
271 'property' => 'background-color',
272 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
273 ),
274 array(
275 'property' => 'background-color',
276 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #payment input[type="radio"]:checked::before',
277 ),
278 array(
279 'property' => 'background-color',
280 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review input[type="radio"]:checked::before',
281 ),
282 array(
283 'property' => 'background-color',
284 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-col2-set input[type="radio"]:checked::before',
285 ),
286 array(
287 'property' => 'background-color',
288 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .woocommerce-checkout #payment button',
289 ),
290 array(
291 'property' => 'background-color',
292 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-customer-login-section__login-button',
293 ),
294 array(
295 'property' => 'background-color',
296 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button',
297 ),
298 array(
299 'property' => 'background-color',
300 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
301 ),
302 array(
303 'property' => 'background-color',
304 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small',
305 ),
306 array(
307 'property' => 'background-color',
308 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button',
309 ),
310 array(
311 'property' => 'background-color',
312 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button',
313 ),
314 array(
315 'property' => 'background-color',
316 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
317 ),
318 array(
319 'property' => 'background-color',
320 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form.wcf-embed-checkout-form-modern-checkout.wcf-modern-skin-multistep .woocommerce form .wcf-multistep-nav-btn-group .wcf-multistep-nav-next-btn',
321 ),
322 array(
323 'property' => 'background-color',
324 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
325 ),
326 array(
327 'property' => 'color',
328 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row .required',
329 ),
330
331 ),
332 );
333 }
334
335 /**
336 * Register Heading Style Controls.
337 *
338 * @since 1.6.15
339 * @access protected
340 */
341 protected function register_heading_style_controls() {
342
343 $this->controls['heading_typography'] = array(
344 'label' => __( 'Typography', 'cartflows' ),
345 'type' => 'typography',
346 'tab' => 'style',
347 'group' => 'section_heading_style_fields',
348 'css' => array(
349 array(
350 'property' => 'font',
351 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce h3',
352 ),
353 array(
354 'property' => 'font',
355 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce h3 span',
356 ),
357 array(
358 'property' => 'font',
359 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout #order_review_heading',
360 ),
361 array(
362 'property' => 'font',
363 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps .step-name',
364 ),
365 array(
366 'property' => 'font',
367 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .col2-set .col-1 h3',
368 ),
369 array(
370 'property' => 'font',
371 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .col2-set .col-2 h3',
372 ),
373
374 ),
375 );
376 }
377
378 /**
379 * Register Input Fields Style Controls.
380 *
381 * @since 1.6.15
382 * @access protected
383 */
384 protected function register_input_style_controls() {
385
386 $this->controls['input_skins'] = array(
387 'label' => __( 'Style', 'cartflows' ),
388 'type' => 'select',
389 'tab' => 'style',
390 'default' => 'default',
391 'group' => 'input_section',
392 'options' => $this->get_skin_types(),
393 );
394
395 $this->controls['input_typography'] = array(
396 'label' => __( 'Typography', 'cartflows' ),
397 'type' => 'typography',
398 'tab' => 'style',
399 'group' => 'input_section',
400 'css' => array(
401 array(
402 'property' => 'font',
403 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row input.input-text::placeholder',
404 ),
405 array(
406 'property' => 'font',
407 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row input.input-text',
408 ),
409 array(
410 'property' => 'font',
411 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row textarea',
412 ),
413 array(
414 'property' => 'font',
415 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .select2-container--default .select2-selection--single',
416 ),
417 array(
418 'property' => 'font',
419 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row select.select',
420 ),
421 array(
422 'property' => 'font',
423 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .col2-set .col-1',
424 ),
425 array(
426 'property' => 'font',
427 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .col2-set .col-2',
428 ),
429 array(
430 'property' => 'font',
431 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form p.form-row label',
432 ),
433 array(
434 'property' => 'font',
435 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #payment [type="radio"]:checked + label',
436 ),
437 array(
438 'property' => 'font',
439 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #payment [type="radio"]:not(:checked) + label',
440 ),
441 array(
442 'property' => 'font',
443 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row select',
444 ),
445 array(
446 'property' => 'font',
447 'selector' => '.wcf-embed-checkout-form .woocommerce #order_review .wcf-custom-coupon-field input[type="text"]',
448 ),
449 array(
450 'property' => 'font',
451 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]::placeholder',
452 ),
453 ),
454 );
455
456 $this->controls['label_color'] = array(
457 'label' => __( 'Label Color', 'cartflows' ),
458 'type' => 'color',
459 'tab' => 'style',
460 'group' => 'input_section',
461 'css' => array(
462 array(
463 'property' => 'color',
464 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout label',
465 ),
466 array(
467 'property' => 'color',
468 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-modern-checkout .woocommerce-checkout label',
469 ),
470 ),
471 );
472
473 $this->controls['input_bgcolor'] = array(
474 'label' => __( 'Field Background Color', 'cartflows' ),
475 'type' => 'color',
476 'tab' => 'style',
477 'default' => '',
478 'group' => 'input_section',
479 'css' => array(
480 array(
481 'property' => 'background-color',
482 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row input.input-text',
483 ),
484 array(
485 'property' => 'background-color',
486 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row textarea',
487 ),
488 array(
489 'property' => 'background-color',
490 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row select',
491 ),
492 array(
493 'property' => 'background-color',
494 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .wcf-coupon-code-input',
495 ),
496 array(
497 'property' => 'background-color',
498 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .select2-container--default .select2-selection--single',
499 ),
500 ),
501 );
502
503 $this->controls['input_color'] = array(
504 'label' => __( 'Input Text / Placeholder Color', 'cartflows' ),
505 'type' => 'color',
506 'tab' => 'style',
507 'group' => 'input_section',
508 'css' => array(
509 array(
510 'property' => 'color',
511 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row input.input-text::placeholder',
512 ),
513 array(
514 'property' => 'color',
515 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row input.input-text',
516 ),
517 array(
518 'property' => 'color',
519 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row textarea',
520 ),
521 array(
522 'property' => 'color',
523 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row select',
524 ),
525 array(
526 'property' => 'color',
527 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]::placeholder',
528 ),
529 ),
530 );
531
532
533 $this->controls['input_border'] = array(
534 'label' => __( 'Input Border', 'cartflows' ),
535 'type' => 'border',
536 'label_block' => false,
537 'group' => 'input_section',
538 'css' => array(
539 array(
540 'property' => 'border',
541 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]',
542 ),
543 array(
544 'property' => 'border',
545 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row input.input-text',
546 ),
547 array(
548 'property' => 'border',
549 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row textarea',
550 ),
551 array(
552 'property' => 'border',
553 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .select2-container--default .select2-selection--single',
554 ),
555 array(
556 'property' => 'border',
557 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row select.select',
558 ),
559 array(
560 'property' => 'border',
561 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce form .form-row select',
562 ),
563 ),
564 );
565 }
566
567 /**
568 * Register Button Style Controls.
569 *
570 * @since 1.6.15
571 * @access protected
572 */
573 protected function register_button_style_controls() {
574
575 $this->controls['buttons_typography'] = array(
576 'label' => __( 'Typography', 'cartflows' ),
577 'type' => 'typography',
578 'tab' => 'style',
579 'group' => 'button_section',
580 'css' => array(
581 array(
582 'property' => 'font',
583 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .woocommerce-checkout #payment button.button',
584 ),
585 array(
586 'property' => 'font',
587 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-customer-login-section__login-button',
588 ),
589 array(
590 'property' => 'font',
591 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button',
592 ),
593 array(
594 'property' => 'font',
595 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #payment #place_order:before',
596 ),
597 array(
598 'property' => 'font',
599 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
600 ),
601 array(
602 'property' => 'font',
603 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small',
604 ),
605 array(
606 'property' => 'font',
607 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button',
608 ),
609 array(
610 'property' => 'font',
611 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button',
612 ),
613
614 array(
615 'property' => 'font',
616 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
617 ),
618 array(
619 'property' => 'font',
620 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form.wcf-embed-checkout-form-modern-checkout.wcf-modern-skin-multistep .woocommerce form .wcf-multistep-nav-btn-group .wcf-multistep-nav-next-btn',
621 ),
622 array(
623 'property' => 'font',
624 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
625 ),
626 ),
627 );
628
629 $this->controls['btn_background_color'] = array(
630 'label' => __( 'Background Color', 'cartflows' ),
631 'type' => 'color',
632 'tab' => 'style',
633 'group' => 'button_section',
634 'css' => array(
635 array(
636 'property' => 'background-color',
637 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .woocommerce-checkout #payment button',
638 ),
639 array(
640 'property' => 'background-color',
641 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-customer-login-section__login-button',
642 ),
643 array(
644 'property' => 'background-color',
645 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button',
646 ),
647 array(
648 'property' => 'background-color',
649 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
650 ),
651 array(
652 'property' => 'background-color',
653 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small',
654 ),
655 array(
656 'property' => 'background-color',
657 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button',
658 ),
659 array(
660 'property' => 'background-color',
661 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button',
662 ),
663 array(
664 'property' => 'background-color',
665 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
666 ),
667 array(
668 'property' => 'background-color',
669 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form.wcf-embed-checkout-form-modern-checkout.wcf-modern-skin-multistep .woocommerce form .wcf-multistep-nav-btn-group .wcf-multistep-nav-next-btn',
670 ),
671 array(
672 'property' => 'background-color',
673 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
674 ),
675 ),
676 );
677
678 $this->controls['btn_border'] = array(
679 'label' => __( 'Border', 'cartflows' ),
680 'type' => 'border',
681 'tab' => 'style',
682 'group' => 'button_section',
683 'css' => array(
684 array(
685 'property' => 'border',
686 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .woocommerce-checkout #payment button',
687 ),
688 array(
689 'property' => 'border',
690 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-customer-login-section__login-button',
691 ),
692 array(
693 'property' => 'border',
694 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button',
695 ),
696 array(
697 'property' => 'border',
698 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
699 ),
700 array(
701 'property' => 'border',
702 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small',
703 ),
704 array(
705 'property' => 'border',
706 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button',
707 ),
708 array(
709 'property' => 'border',
710 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button',
711 ),
712 array(
713 'property' => 'border',
714 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
715 ),
716 array(
717 'property' => 'border',
718 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form.wcf-embed-checkout-form-modern-checkout.wcf-modern-skin-multistep .woocommerce form .wcf-multistep-nav-btn-group .wcf-multistep-nav-next-btn',
719 ),
720 array(
721 'property' => 'border',
722 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
723 ),
724 ),
725 );
726
727 $this->controls['button_box_shadow'] = array(
728 'label' => __( 'Box Shadow', 'cartflows' ),
729 'type' => 'box-shadow',
730 'tab' => 'style',
731 'group' => 'button_section',
732 'css' => array(
733 array(
734 'property' => 'box-shadow',
735 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .woocommerce-checkout #payment button',
736 ),
737 array(
738 'property' => 'box-shadow',
739 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce .wcf-customer-login-section__login-button',
740 ),
741 array(
742 'property' => 'box-shadow',
743 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button',
744 ),
745 array(
746 'property' => 'box-shadow',
747 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .wcf-custom-coupon-field button.wcf-submit-coupon',
748 ),
749 array(
750 'property' => 'box-shadow',
751 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small',
752 ),
753 array(
754 'property' => 'box-shadow',
755 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button',
756 ),
757 array(
758 'property' => 'box-shadow',
759 'selector' => '.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button',
760 ),
761 array(
762 'property' => 'box-shadow',
763 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form-two-step .woocommerce .wcf-embed-checkout-form-nav-btns .wcf-next-button',
764 ),
765 array(
766 'property' => 'box-shadow',
767 'selector' => '.wcf-bricks-checkout-form .wcf-bricks-checkout-form .wcf-embed-checkout-form.wcf-embed-checkout-form-modern-checkout.wcf-modern-skin-multistep .woocommerce form .wcf-multistep-nav-btn-group .wcf-multistep-nav-next-btn',
768 ),
769 array(
770 'property' => 'box-shadow',
771 'selector' => 'body .wcf-pre-checkout-offer-wrapper #wcf-pre-checkout-offer-content button.wcf-pre-checkout-offer-btn',
772 ),
773 array(
774 'property' => 'box-shadow',
775 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form.wcf-embed-checkout-form-modern-checkout.wcf-modern-skin-multistep .woocommerce form .wcf-multistep-nav-btn-group .wcf-multistep-nav-next-btn',
776 ),
777 ),
778 );
779 }
780
781 /**
782 * Register Sections error Controls.
783 *
784 * @since 1.6.15
785 * @access protected
786 */
787 protected function register_error_style_controls() {
788
789
790 $this->controls['error_fields_heading'] = array(
791 'label' => __( 'Field Validation', 'cartflows' ),
792 'type' => 'heading',
793 'label_block' => true,
794 'group' => 'section_error_style_fields',
795 );
796
797 $this->controls['field_label_color'] = array(
798 'label' => __( 'Label Color', 'cartflows' ),
799 'type' => 'color',
800 'label_block' => true,
801 'group' => 'section_error_style_fields',
802 'css' => array(
803 array(
804 'property' => 'color',
805 'selector' => '.woocommerce-checkout .woocommerce-invalid label',
806 ),
807 array(
808 'property' => 'color',
809 'selector' => '.wcf-embed-checkout-form .woocommerce form p.form-row.woocommerce-invalid label',
810 ),
811 array(
812 'property' => 'color',
813 'selector' => '.woocommerce form .form-row.woocommerce-invalid label',
814 ),
815 ),
816
817 );
818
819 $this->controls['error_field_border_color'] = array(
820 'selector' => '.select2-container--default.field-required',
821 'label' => __( 'Field Border Color', 'cartflows' ),
822 'type' => 'color',
823 'label_block' => true,
824 'group' => 'section_error_style_fields',
825 'css' => array(
826 array(
827 'property' => 'border-color',
828 'selector' => '.select2-container--default.field-required .select2-selection--single',
829 ),
830 array(
831 'property' => 'border-color',
832 'selector' => '.woocommerce form .form-row input.input-text.field-required',
833 ),
834 array(
835 'property' => 'border-color',
836 'selector' => '.woocommerce form .form-row textarea.input-text.field-required',
837 ),
838 array(
839 'property' => 'border-color',
840 'selector' => '.woocommerce #order_review .input-text.field-required',
841 ),
842 array(
843 'property' => 'border-color',
844 'selector' => '.woocommerce form .form-row.woocommerce-invalid .select2-container',
845 ),
846 array(
847 'property' => 'border-color',
848 'selector' => '.woocommerce form .form-row.woocommerce-invalid input.input-text',
849 ),
850 array(
851 'property' => 'border-color',
852 'selector' => '.woocommerce form .form-row.woocommerce-invalid select',
853 ),
854 ),
855 );
856
857 $this->controls['error_fields_section'] = array(
858 'label' => __( 'Error Messages', 'cartflows' ),
859 'type' => 'heading',
860 'label_block' => true,
861 'group' => 'section_error_style_fields',
862 );
863
864 $this->controls['error_text_color'] = array(
865 'label' => __( 'Error Message Color', 'cartflows' ),
866 'type' => 'color',
867 'label_block' => true,
868 'group' => 'section_error_style_fields',
869 'css' => array(
870 array(
871 'property' => 'color',
872 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-error',
873 ),
874 array(
875 'property' => 'color',
876 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error',
877 ),
878 array(
879 'property' => 'color',
880 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error',
881 ),
882
883 ),
884 );
885
886 $this->controls['error_bg_color'] = array(
887 'label' => __( 'Background Color', 'cartflows' ),
888 'type' => 'color',
889 'label_block' => true,
890 'group' => 'section_error_style_fields',
891 'css' => array(
892 array(
893 'property' => 'background-color',
894 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-error',
895 ),
896 array(
897 'property' => 'background-color',
898 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error',
899 ),
900 array(
901 'property' => 'background-color',
902 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error',
903 ),
904
905 ),
906 );
907
908 $this->controls['error_border_color'] = array(
909 'label' => __( 'Border Color', 'cartflows' ),
910 'type' => 'color',
911 'label_block' => true,
912 'group' => 'section_error_style_fields',
913 'css' => array(
914 array(
915 'property' => 'border-color',
916 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-error',
917 ),
918 array(
919 'property' => 'border-color',
920 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error',
921 ),
922 array(
923 'property' => 'border-color',
924 'selector' => '.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error',
925 ),
926
927 ),
928 );
929 }
930
931 /**
932 * Register order review column style controls
933 */
934 protected function register_order_review_style_controls() {
935 $this->controls['order_review_section_text_color'] = array(
936 'label' => __( 'Text Color', 'cartflows' ),
937 'type' => 'color',
938 'label_block' => true,
939 'group' => 'section_order_review_column',
940 'css' => array(
941 array(
942 'property' => 'color',
943 'selector' => '.wcf-embed-checkout-form table.shop_table th',
944 ),
945 array(
946 'property' => 'color',
947 'selector' => '.wcf-embed-checkout-form table.shop_table td',
948 ),
949 ),
950 );
951
952
953 $this->controls['order_review_section_bg_color'] = array(
954 'label' => __( 'Background Color', 'cartflows' ),
955 'type' => 'color',
956 'label_block' => true,
957 'group' => 'section_order_review_column',
958 'css' => array(
959 array(
960 'property' => 'background-color',
961 'selector' => '.wcf-embed-checkout-form table.shop_table',
962 ),
963 array(
964 'property' => 'background-color',
965 'selector' => '.wcf-embed-checkout-form table.shop_table tbody',
966 ),
967 array(
968 'property' => 'background-color',
969 'selector' => '.wcf-embed-checkout-form table.shop_table tfoot tr.cart-discount',
970 ),
971 array(
972 'property' => 'background-color',
973 'selector' => '.wcf-embed-checkout-form. table.shop_table tfoot tr.cart-subtotal',
974 ),
975 array(
976 'property' => 'background-color',
977 'selector' => '.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not( .recurring-total ) th',
978 ),
979 array(
980 'property' => 'background-color',
981 'selector' => '.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not( .recurring-total ) td',
982 ),
983 ),
984 );
985
986 $this->controls['order_review_section_border'] = array(
987 'label' => __( 'Border', 'cartflows' ),
988 'type' => 'border',
989 'label_block' => false,
990 'group' => 'section_order_review_column',
991 'css' => array(
992 array(
993 'property' => 'border',
994 'selector' => '.wcf-embed-checkout-form table.shop_table',
995 ),
996 array(
997 'property' => 'border',
998 'selector' => '.wcf-embed-checkout-form table.shop_table tbody',
999 ),
1000 array(
1001 'property' => 'border',
1002 'selector' => '.wcf-embed-checkout-form table.shop_table tfoot tr.cart-discount',
1003 ),
1004 array(
1005 'property' => 'border',
1006 'selector' => '.wcf-embed-checkout-form. table.shop_table tfoot tr.cart-subtotal',
1007 ),
1008 array(
1009 'property' => 'border',
1010 'selector' => '.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not( .recurring-total ) th',
1011 ),
1012 array(
1013 'property' => 'border',
1014 'selector' => '.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not( .recurring-total ) td',
1015 ),
1016 ),
1017 );
1018 }
1019
1020 /**
1021 * Register Sections Style Controls.
1022 *
1023 * @since 1.6.15
1024 * @access protected
1025 */
1026 protected function register_payment_section_style_controls() {
1027
1028 $this->controls['payment_section_text_color'] = array(
1029 'label' => __( 'Label Color', 'cartflows' ),
1030 'type' => 'color',
1031 'label_block' => true,
1032 'group' => 'section_payment_style_fields',
1033 'css' => array(
1034 array(
1035 'property' => 'color',
1036 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #payment [type="radio"]:checked + label',
1037 ),
1038 array(
1039 'property' => 'color',
1040 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce #payment [type="radio"]:not( :checked ) + label',
1041 ),
1042
1043 ),
1044 );
1045 $this->controls['payment_section_desc_color'] = array(
1046 'label' => __( 'Description Color', 'cartflows' ),
1047 'type' => 'color',
1048 'label_block' => true,
1049 'group' => 'section_payment_style_fields',
1050 'css' => array(
1051 array(
1052 'property' => 'color',
1053 'selector' => '.wcf-bricks-checkout-form .wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box',
1054 ),
1055 ),
1056 );
1057 $this->controls['payment_section_bg_color'] = array(
1058 'label' => __( 'Section Background Color', 'cartflows' ),
1059 'type' => 'color',
1060 'label_block' => true,
1061 'group' => 'section_payment_style_fields',
1062 'css' => array(
1063 array(
1064 'property' => 'background-color',
1065 'selector' => '.woocommerce-checkout #payment ul.payment_methods',
1066 ),
1067 ),
1068 );
1069
1070 $this->controls['payment_section_padding_dimension'] = array(
1071 'label' => __( 'Section Padding', 'cartflows' ),
1072 'type' => 'dimensions',
1073 'label_block' => true,
1074 'group' => 'section_payment_style_fields',
1075 'css' => array(
1076 array(
1077 'property' => 'padding',
1078 'selector' => '.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods',
1079 ),
1080 ),
1081 );
1082
1083 $this->controls['payment_section_margin_dimension'] = array(
1084 'label' => __( 'Section Margin', 'cartflows' ),
1085 'type' => 'dimensions',
1086 'label_block' => true,
1087 'group' => 'section_payment_style_fields',
1088 'css' => array(
1089 array(
1090 'property' => 'margin',
1091 'selector' => '.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods',
1092 ),
1093 ),
1094 );
1095
1096 $this->controls['payment_section_border_radius'] = array(
1097 'label' => __( 'Border Radius', 'cartflows' ),
1098 'type' => 'unit',
1099 'label_block' => true,
1100 'group' => 'section_payment_style_fields',
1101 'css' => array(
1102 array(
1103 'property' => 'border-radius',
1104 'selector' => '.woocommerce-checkout #payment ul.payment_methods',
1105 ),
1106 ),
1107 );
1108 }
1109
1110 /**
1111 * Register shipping method column style controls
1112 *
1113 * @access protected
1114 * @return void
1115 */
1116 protected function register_shipping_method_style_controls() {
1117
1118 $this->controls['shipping_method_section_bg_color'] = array(
1119 'label' => __( 'Background Color', 'cartflows' ),
1120 'type' => 'color',
1121 'label_block' => true,
1122 'group' => 'section_shipping_method_column',
1123 'css' => array(
1124 array(
1125 'property' => 'background-color',
1126 'selector' => '.woocommerce-checkout .wcf-customer-shipping ul#shipping_method',
1127 ),
1128 ),
1129 );
1130 }
1131
1132 /**
1133 * Function to get skin types.
1134 *
1135 * @since 1.6.15
1136 * @access protected
1137 */
1138 protected function get_skin_types() {
1139
1140 $skin_options = array(
1141 'default' => __( 'Default', 'cartflows' ),
1142 'modern-label' => __( 'Modern Labels', 'cartflows' ),
1143 );
1144
1145 return $skin_options;
1146 }
1147
1148 /**
1149 * Set builder control groups
1150 *
1151 * @since 3.1.0
1152 * @access public
1153 */
1154 public function set_control_groups() {
1155 $this->control_groups['section_general_style_fields'] = array(
1156 'title' => esc_html__( 'Global', 'cartflows' ),
1157 'tab' => 'style',
1158 );
1159 $this->control_groups['input_section'] = array(
1160 'title' => esc_html__( 'Input Fields', 'cartflows' ),
1161 'tab' => 'style',
1162 );
1163 $this->control_groups['section_heading_style_fields'] = array(
1164 'title' => esc_html__( 'Heading', 'cartflows' ),
1165 'tab' => 'style',
1166 );
1167 $this->control_groups['button_section'] = array(
1168 'title' => esc_html__( 'Buttons (Normal)', 'cartflows' ),
1169 'tab' => 'style',
1170 );
1171 $this->control_groups['section_order_review_column'] = array(
1172 'title' => esc_html__( 'Order Review', 'cartflows' ),
1173 'tab' => 'style',
1174 );
1175 $this->control_groups['section_error_style_fields'] = array(
1176 'title' => esc_html__( 'Field Validation & Error Messages', 'cartflows' ),
1177 'tab' => 'style',
1178 );
1179 $this->control_groups['section_payment_style_fields'] = array(
1180 'title' => esc_html__( 'Payment Section', 'cartflows' ),
1181 'tab' => 'style',
1182 );
1183 $this->control_groups['section_shipping_method_column'] = array(
1184 'title' => esc_html__( 'Shipping Method', 'cartflows' ),
1185 'tab' => 'style',
1186 );
1187 }
1188 /**
1189 * Constructor function.
1190 */
1191 public function set_controls() {
1192 $this->register_general_content_controls();
1193 $this->register_global_style_controls();
1194 $this->register_heading_style_controls();
1195 $this->register_input_style_controls();
1196 $this->register_button_style_controls();
1197 $this->register_payment_section_style_controls();
1198 $this->register_error_style_controls();
1199 $this->register_order_review_style_controls();
1200 $this->register_shipping_method_style_controls();
1201 }
1202
1203 /**
1204 * Render Checkout Form.
1205 *
1206 * @since 2.1.0
1207 * @access public
1208 */
1209 public function render() {
1210 $checkout_id = $this->post_id;
1211 $this->set_attribute( '_root', 'data-element-id', $checkout_id );
1212 $this->dynamic_option_filters();
1213
1214 do_action( 'cartflows_bricks_before_checkout_shortcode', $checkout_id );
1215
1216 ?>
1217 <div <?php echo $this->render_attributes( '_root' ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> >
1218 <div class = "wcf-bricks-checkout-form cartflows-bricks__checkout-form">
1219 <?php
1220 echo do_shortcode( '[cartflows_checkout]' );
1221 ?>
1222 </div>
1223 </div>
1224 <?php
1225 }
1226
1227 /**
1228 * Function to apply dynamic option filters.
1229 *
1230 * @access protected
1231 */
1232 public function dynamic_option_filters() {
1233
1234 $checkout_fields = array(
1235 array(
1236 'filter_slug' => 'wcf-fields-skins',
1237 'setting_name' => 'input_skins',
1238 ),
1239 array(
1240 'filter_slug' => 'wcf-checkout-layout',
1241 'setting_name' => 'layout',
1242 ),
1243 );
1244
1245 if ( isset( $checkout_fields ) && is_array( $checkout_fields ) ) {
1246
1247 foreach ( $checkout_fields as $key => $field ) {
1248
1249 $setting_name = $field['setting_name'];
1250
1251 if ( '' !== $this->settings[ $setting_name ] ) {
1252
1253 add_filter(
1254 'cartflows_checkout_meta_' . $field['filter_slug'],
1255 function ( $value ) use ( $setting_name ) {
1256
1257 $value = $this->settings[ $setting_name ];
1258
1259 return $value;
1260 },
1261 10,
1262 1
1263 );
1264 }
1265 }
1266 }
1267
1268 do_action( 'cartflows_bricks_checkout_options_filters', $this->settings );
1269 }
1270 }
1271