PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / modules / page-checkout / widgets / page-checkout.php

page-checkout.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 3.1.4, at modules/page-checkout/widgets/page-checkout.php

1,148 lines 48.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimateStoreKit\Modules\PageCheckout\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Typography;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Plugin;
10
11 use UltimateStoreKit\Base\Module_Base;
12
13 if (!defined('ABSPATH'))
14 exit; // Exit if accessed directly
15
16 class Page_Checkout extends Module_Base
17 {
18
19 public function get_name()
20 {
21 return 'usk-page-checkout';
22 }
23
24 public function get_title()
25 {
26 return BDTUSK . esc_html__('Checkout (Page)', 'ultimate-store-kit');
27 }
28
29 public function get_icon()
30 {
31 return 'usk-widget-icon usk-icon-page-checkout usk-new';
32 }
33
34 public function get_categories()
35 {
36 return ['ultimate-store-kit-checkout'];
37 }
38 public function show_in_panel()
39 {
40 return get_post_type() !== 'page';
41 }
42
43 public function get_keywords()
44 {
45 return ['cart', 'order', 'wc', 'checkout', 'page'];
46 }
47
48 public function get_style_depends()
49 {
50 if ($this->usk_is_edit_mode()) {
51 return ['usk-all-styles'];
52 } else {
53 return ['wc-checkout', 'usk-font', 'usk-page-checkout'];
54 }
55 }
56
57 public function get_script_depends()
58 {
59 return ['usk-page-checkout'];
60 }
61
62 public function has_widget_inner_wrapper(): bool
63 {
64 return !\Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
65 }
66 protected function register_controls()
67 {
68 $this->start_controls_section(
69 'section_checkout_general',
70 [
71 'label' => esc_html__('Layout', 'ultimate-store-kit'),
72 'tab' => Controls_Manager::TAB_CONTENT,
73 ]
74 );
75
76 $this->add_control(
77 'show_shipping_form',
78 [
79 'label' => esc_html__( 'Shipping Form', 'ultimate-store-kit' ) . BDTUSK_NC,
80 'type' => Controls_Manager::SWITCHER,
81 'return_value' => 'yes',
82 'default' => 'yes',
83 ]
84 );
85
86 $this->end_controls_section();
87
88 $this->start_controls_section(
89 'section_texts_translation',
90 [
91 'label' => esc_html__( 'All String Translations', 'ultimate-store-kit' ),
92 'type' => Controls_Manager::TAB_CONTENT,
93 ]
94 );
95
96 $this->add_control(
97 'text_billing_details_heading',
98 [
99 'label' => esc_html__( 'Billing Details', 'ultimate-store-kit' ),
100 'type' => Controls_Manager::TEXT,
101 'default' => esc_html__( 'Billing details', 'ultimate-store-kit' ),
102 'dynamic' => [ 'active' => true ],
103 ]
104 );
105
106 $this->add_control(
107 'text_billing_shipping_heading',
108 [
109 'label' => esc_html__( 'Billing+Shipping', 'ultimate-store-kit' ),
110 'type' => Controls_Manager::TEXT,
111 'default' => esc_html__( 'Billing and Shipping', 'ultimate-store-kit' ),
112 'dynamic' => [ 'active' => true ],
113 ]
114 );
115
116 $this->add_control(
117 'text_ship_to_different_address',
118 [
119 'label' => esc_html__( 'Shipping Toggle', 'ultimate-store-kit' ),
120 'type' => Controls_Manager::TEXT,
121 'default' => esc_html__( 'Ship to a different address?', 'ultimate-store-kit' ),
122 'dynamic' => [ 'active' => true ],
123 'condition' => [
124 'show_shipping_form' => 'yes',
125 ],
126 ]
127 );
128
129 $this->add_control(
130 'text_order_review_heading',
131 [
132 'label' => esc_html__( 'Order Review', 'ultimate-store-kit' ),
133 'type' => Controls_Manager::TEXT,
134 'default' => esc_html__( 'Your order', 'ultimate-store-kit' ),
135 'dynamic' => [ 'active' => true ],
136 ]
137 );
138
139 $this->add_control(
140 'text_create_account',
141 [
142 'label' => esc_html__( 'Create Account', 'ultimate-store-kit' ),
143 'type' => Controls_Manager::TEXT,
144 'default' => esc_html__( 'Create an account?', 'ultimate-store-kit' ),
145 'dynamic' => [ 'active' => true ],
146 ]
147 );
148
149 $this->end_controls_section();
150
151 $this->start_controls_section(
152 'section_checkout_shipping_form_container',
153 [
154 'label' => esc_html__('Container', 'ultimate-store-kit'),
155 'tab' => Controls_Manager::TAB_STYLE,
156 ]
157 );
158
159 $this->add_control(
160 'checkout_shipping_form_container_bg',
161 [
162 'label' => esc_html__('Background', 'ultimate-store-kit'),
163 'type' => Controls_Manager::COLOR,
164 'selectors' => [
165 '{{WRAPPER}} .usk-page-checkout .usk-checkout-billing-address, {{WRAPPER}} .usk-page-checkout .usk-checkout-payment, {{WRAPPER}} .usk-page-checkout .usk-checkout-order-review, {{WRAPPER}} .usk-page-checkout .usk-checkout-shipping-form' => 'background-color: {{VALUE}};'
166 ],
167 ]
168 );
169
170 $this->add_responsive_control(
171 'checkout_shipping_form_container_padding',
172 [
173 'label' => esc_html__('Padding', 'ultimate-store-kit'),
174 'type' => Controls_Manager::DIMENSIONS,
175 'selectors' => [
176 '{{WRAPPER}} .usk-page-checkout .usk-checkout-billing-address, {{WRAPPER}} .usk-page-checkout .usk-checkout-payment, {{WRAPPER}} .usk-page-checkout .usk-checkout-order-review, {{WRAPPER}} .usk-page-checkout .usk-checkout-shipping-form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
177 ],
178
179 ]
180 );
181 $this->add_responsive_control(
182 'checkout_shipping_form_container_margin',
183 [
184 'label' => esc_html__('Margin', 'ultimate-store-kit'),
185 'type' => Controls_Manager::DIMENSIONS,
186 'selectors' => [
187 '{{WRAPPER}} .usk-page-checkout .usk-checkout-billing-address, {{WRAPPER}} .usk-page-checkout .usk-checkout-payment, {{WRAPPER}} .usk-page-checkout .usk-checkout-order-review, {{WRAPPER}} .usk-page-checkout .usk-checkout-shipping-form' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
188 ],
189 'separator' => 'after'
190 ]
191 );
192 $this->add_group_control(
193 Group_Control_Border::get_type(),
194 [
195 'name' => 'checkout_shipping_form_container_border',
196 'label' => __('Border', 'ultimate-store-kit'),
197 'selector' => '{{WRAPPER}} .usk-page-checkout .usk-checkout-billing-address, {{WRAPPER}} .usk-page-checkout .usk-checkout-payment, {{WRAPPER}} .usk-page-checkout .usk-checkout-order-review, {{WRAPPER}} .usk-page-checkout .usk-checkout-shipping-form',
198 ]
199
200 );
201
202 $this->add_responsive_control(
203 'checkout_shipping_form_container_radius',
204 [
205 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
206 'type' => Controls_Manager::DIMENSIONS,
207 'selectors' => [
208 '{{WRAPPER}} .usk-page-checkout .usk-checkout-billing-address, {{WRAPPER}} .usk-page-checkout .usk-checkout-payment, {{WRAPPER}} .usk-page-checkout .usk-checkout-order-review, {{WRAPPER}} .usk-page-checkout .usk-checkout-shipping-form' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
209 ],
210
211 ]
212 );
213
214 $this->add_group_control(
215 Group_Control_Box_Shadow::get_type(),
216 [
217 'name' => 'checkout_shipping_form_container_box_shadow',
218 'label' => __('Box Shadow', 'ultimate-store-kit'),
219 'selector' => '{{WRAPPER}} .usk-page-checkout .usk-checkout-billing-address, {{WRAPPER}} .usk-page-checkout .usk-checkout-payment, {{WRAPPER}} .usk-page-checkout .usk-checkout-order-review, {{WRAPPER}} .usk-page-checkout .usk-checkout-shipping-form',
220 ]
221 );
222 $this->end_controls_section();
223
224 $this->start_controls_section(
225 'section_style_heading',
226 [
227 'label' => __('Heading', 'ultimate-store-kit'),
228 'tab' => Controls_Manager::TAB_STYLE,
229 ]
230 );
231 $this->add_control(
232 'heading_color',
233 [
234 'label' => __('Color', 'ultimate-store-kit'),
235 'type' => Controls_Manager::COLOR,
236 'selectors' => [
237 '{{WRAPPER}} .usk-checkout-order-review .order_review_heading, {{WRAPPER}} .usk-checkout-billing-address .usk-checkout-billing-address-header, {{WRAPPER}} .usk-page-checkout #ship-to-different-address' => 'color: {{VALUE}}',
238 ],
239 ]
240 );
241
242 $this->add_control(
243 'heading_border_color',
244 [
245 'label' => __('Border Color', 'ultimate-store-kit'),
246 'type' => Controls_Manager::COLOR,
247 'selectors' => [
248 '{{WRAPPER}} .usk-checkout-order-review .order_review_heading:after, {{WRAPPER}} .usk-checkout-billing-address .usk-checkout-billing-address-header:after, {{WRAPPER}} .usk-page-checkout #ship-to-different-address:after' => 'background: {{VALUE}}',
249 ],
250 ]
251 );
252
253 $this->add_group_control(
254 Group_Control_Typography::get_type(),
255 [
256 'name' => 'heading_typography',
257 'label' => __('Typography', 'ultimate-store-kit'),
258 'selector' => '{{WRAPPER}} .usk-checkout-order-review .order_review_heading, {{WRAPPER}} .usk-checkout-billing-address .usk-checkout-billing-address-header, {{WRAPPER}} .usk-page-checkout #ship-to-different-address',
259 ]
260 );
261
262 $this->add_responsive_control(
263 'heading_bottom_spacing',
264 [
265 'label' => __('Bottom Spacing', 'ultimate-store-kit'),
266 'type' => Controls_Manager::SLIDER,
267 'size_units' => ['px', '%', 'vh'],
268 'selectors' => [
269 '{{WRAPPER}} .usk-checkout-order-review .order_review_heading, {{WRAPPER}} .usk-checkout-billing-address .usk-checkout-billing-address-header, {{WRAPPER}} .usk-page-checkout #ship-to-different-address' => 'margin-bottom: {{SIZE}}{{UNIT}};',
270 ],
271 'separator' => 'before'
272 ]
273 );
274
275 $this->end_controls_section();
276
277
278 $this->start_controls_section(
279 'section_checkout_billing_address_form',
280 [
281 'label' => __('Form', 'ultimate-store-kit'),
282 'tab' => Controls_Manager::TAB_STYLE,
283 ]
284 );
285 $this->start_controls_tabs(
286 'tabs_checkout_billing_address_forms'
287 );
288 $this->start_controls_tab(
289 'tab_checkout_billing_address_label',
290 [
291 'label' => __('Label', 'ultimate-store-kit'),
292 ]
293 );
294
295 $this->add_control(
296 'checkout_billing_address_input_label_color',
297 [
298 'label' => esc_html__('Color', 'ultimate-store-kit'),
299 'type' => Controls_Manager::COLOR,
300 'selectors' => [
301 '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper .form-row label,
302 {{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper .form-row label' => 'color: {{VALUE}}',
303 ],
304 ]
305 );
306
307 $this->add_control(
308 'checkout_billing_address_input_label_indicator_color',
309 [
310 'label' => esc_html__('Required Indicator Color:', 'ultimate-store-kit'),
311 'type' => Controls_Manager::COLOR,
312 'selectors' => [
313 '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper .form-row label .required,
314 {{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper .form-row label .required' => 'color: {{VALUE}}',
315 ],
316 ]
317 );
318 $this->add_responsive_control(
319 'title',
320 [
321 'label' => __('Bottom Spacing', 'ultimate-store-kit'),
322 'type' => Controls_Manager::SLIDER,
323 'selectors' => [
324 '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper .form-row label,
325 {{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper .form-row label' => 'margin-bottom: {{SIZE}}{{UNIT}};',
326 ],
327 'separator' => 'before'
328 ]
329 );
330
331 $this->add_group_control(
332 Group_Control_Typography::get_type(),
333 [
334 'name' => 'checkout_billing_address_input_label_typography',
335 'label' => __('Typography', 'ultimate-store-kit'),
336 'selector' => '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper .form-row label, {{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper .form-row label',
337 'separator' => 'before'
338 ]
339 );
340
341 $this->end_controls_tab();
342 $this->start_controls_tab(
343 'tab_checkout_billing_address_input',
344 [
345 'label' => __('Input', 'ultimate-store-kit'),
346 ]
347 );
348 $this->add_control(
349 'checkout_billing_address_input_color',
350 [
351 'label' => esc_html__('Color', 'ultimate-store-kit'),
352 'type' => Controls_Manager::COLOR,
353 'default' => 'var(--usk-text-body)',
354 'selectors' => [
355 '{{WRAPPER}} .usk-page-checkout .form-row .input-text, {{WRAPPER}} .usk-page-checkout .form-row select, {{WRAPPER}} .usk-page-checkout .select2-container--default .select2-selection--single .select2-selection__rendered' => 'color: {{VALUE}};',
356 ],
357 ]
358 );
359
360 $this->add_control(
361 'checkout_billing_address_input_placeholder_color',
362 [
363 'label' => esc_html__('Placeholder Color', 'ultimate-store-kit'),
364 'type' => Controls_Manager::COLOR,
365 'selectors' => [
366 '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)::placeholder' => 'color: {{VALUE}};',
367 '{{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)::placeholder' => 'color: {{VALUE}};',
368 ],
369 ]
370 );
371 $this->add_control(
372 'checkout_billing_address_input_background',
373 [
374 'label' => esc_html__('Background', 'ultimate-store-kit'),
375 'type' => Controls_Manager::COLOR,
376 'default' => 'var(--usk-white)',
377 'selectors' => [
378 '{{WRAPPER}} .usk-page-checkout .form-row .input-text, {{WRAPPER}} .usk-page-checkout .form-row select, {{WRAPPER}} .usk-page-checkout .form-row .select2-selection' => 'background: {{VALUE}};',
379 ],
380 ]
381 );
382
383 $this->add_responsive_control(
384 'checkout_billing_address_input_padding',
385 [
386 'label' => esc_html__('Padding', 'ultimate-store-kit'),
387 'type' => Controls_Manager::DIMENSIONS,
388 'selectors' => [
389 '{{WRAPPER}} .usk-page-checkout .woocommerce-billing-fields__field-wrapper p.form-row .input-text,
390 {{WRAPPER}} .usk-page-checkout .woocommerce-shipping-fields__field-wrapper p.form-row .input-text,
391 {{WRAPPER}} .usk-page-checkout .woocommerce-billing-fields__field-wrapper p.form-row select,
392 {{WRAPPER}} .usk-page-checkout .woocommerce-shipping-fields__field-wrapper p.form-row select,
393 {{WRAPPER}} .usk-page-checkout .woocommerce-billing-fields__field-wrapper p.form-row .select2-selection,
394 {{WRAPPER}} .usk-page-checkout .woocommerce-shipping-fields__field-wrapper p.form-row .select2-selection,
395 {{WRAPPER}} .usk-page-checkout .select2-container--default .select2-selection--single .select2-selection__rendered' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
396 ],
397 'separator' => 'before',
398 ]
399 );
400
401 $this->add_control(
402 'checkout_billing_address_input_margin',
403 [
404 'label' => esc_html__('Margin', 'ultimate-store-kit'),
405 'type' => Controls_Manager::DIMENSIONS,
406 'selectors' => [
407 '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select),
408 {{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;'
409 ],
410 ]
411 );
412
413 $this->add_group_control(
414 Group_Control_Border::get_type(),
415 [
416 'name' => 'checkout_billing_address_input_border',
417 'label' => esc_html__('Border', 'ultimate-store-kit'),
418 'default' => [
419 'color' => 'var(--usk-border-input)',
420 'width' => 1,
421 ],
422 'selector' => '{{WRAPPER}} .usk-page-checkout .form-row .input-text, {{WRAPPER}} .usk-page-checkout .form-row select, {{WRAPPER}} .usk-page-checkout .form-row .select2-selection',
423 ]
424 );
425 $this->add_control(
426 'checkout_billing_address_input_border_radius',
427 [
428 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
429 'type' => Controls_Manager::DIMENSIONS,
430 'selectors' => [
431 '{{WRAPPER}} .usk-checkout-billing-address .woocommerce-billing-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select),
432 {{WRAPPER}} .usk-checkout-shipping-form .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;'
433 ],
434 ]
435 );
436
437 $this->add_control(
438 'heading_input_focus',
439 [
440 'label' => __('Focus', 'ultimate-store-kit'),
441 'type' => Controls_Manager::HEADING,
442 'separator' => 'before',
443 ]
444 );
445
446 $this->add_control(
447 'input_focus_border_color',
448 [
449 'label' => esc_html__('Focus Border Color', 'ultimate-store-kit'),
450 'type' => Controls_Manager::COLOR,
451 'default' => 'var(--usk-primary)',
452 'selectors' => [
453 '{{WRAPPER}} .usk-page-checkout .form-row .input-text:focus, {{WRAPPER}} .usk-page-checkout .form-row select:focus, {{WRAPPER}} .usk-page-checkout .form-row .select2-selection:focus' => 'outline: none; border-color: {{VALUE}}; box-shadow: var(--usk-shadow-focus);',
454 ],
455 ]
456 );
457
458 $this->add_control(
459 'input_focus_background',
460 [
461 'label' => esc_html__('Focus Background', 'ultimate-store-kit'),
462 'type' => Controls_Manager::COLOR,
463 'selectors' => [
464 '{{WRAPPER}} .usk-page-checkout .form-row .input-text:focus, {{WRAPPER}} .usk-page-checkout .form-row select:focus, {{WRAPPER}} .usk-page-checkout .form-row .select2-selection:focus' => 'background: {{VALUE}};',
465 ],
466 ]
467 );
468
469 $this->end_controls_tab();
470 $this->end_controls_tabs();
471 $this->end_controls_section();
472 $this->start_controls_section(
473 'section_style_layout',
474 [
475 'label' => __('Order Details', 'ultimate-store-kit'),
476 'tab' => Controls_Manager::TAB_STYLE,
477 ]
478 );
479 $this->add_group_control(
480 Group_Control_Border::get_type(),
481 [
482 'name' => 'table_border',
483 'label' => __('Border', 'ultimate-store-kit'),
484 'selector' => '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table th,
485 {{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table td',
486 ]
487 );
488 $this->start_controls_tabs(
489 'tabs_table_header'
490 );
491 $this->start_controls_tab(
492 'tab_table_header',
493 [
494 'label' => __('HEADER', 'ultimate-store-kit'),
495 ]
496 );
497 $this->add_control(
498 'orders_header_color',
499 [
500 'label' => esc_html__('Text Color', 'ultimate-store-kit'),
501 'type' => Controls_Manager::COLOR,
502 'selectors' => [
503 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table thead th' => 'color: {{VALUE}}',
504 ],
505 ]
506 );
507
508 $this->add_control(
509 'orders_header_background',
510 [
511 'label' => esc_html__('Background', 'ultimate-store-kit'),
512 'type' => Controls_Manager::COLOR,
513 'selectors' => [
514 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table thead th' => 'background-color: {{VALUE}}',
515 ],
516 ]
517 );
518
519
520 $this->add_responsive_control(
521 'table_header_padding',
522 [
523 'label' => esc_html__('Padding', 'ultimate-store-kit'),
524 'type' => Controls_Manager::DIMENSIONS,
525 'selectors' => [
526 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table thead th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
527 '.rtl {{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table thead th' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;',
528 ],
529 'separator' => 'after'
530 ]
531 );
532
533 $this->add_group_control(
534 Group_Control_Typography::get_type(),
535 [
536 'name' => 'orders_header_text_typography',
537 'label' => esc_html__('Typography', 'ultimate-store-kit'),
538 'selector' => '{{WRAPPER}} .usk-checkout-order-review #order_review .woocommerce-checkout-review-order-table thead th',
539 ]
540 );
541 $this->end_controls_tab();
542 $this->start_controls_tab(
543 'tab_table_body',
544 [
545 'label' => __('BODY', 'ultimate-store-kit'),
546 ]
547 );
548 $this->add_control(
549 'table_body_text_color',
550 [
551 'label' => esc_html__('Text Color', 'ultimate-store-kit'),
552 'type' => Controls_Manager::COLOR,
553 'selectors' => [
554 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tbody td' => 'color: {{VALUE}}',
555 ],
556 ]
557 );
558
559 $this->add_control(
560 'orders_body_background',
561 [
562 'label' => esc_html__('Background', 'ultimate-store-kit'),
563 'type' => Controls_Manager::COLOR,
564 'selectors' => [
565 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table > tbody > tr' => 'background-color: {{VALUE}} !important',
566 ],
567 ]
568 );
569 $this->add_control(
570 'table_body_price_color',
571 [
572 'label' => esc_html__('Price Color', 'ultimate-store-kit'),
573 'type' => Controls_Manager::COLOR,
574 'selectors' => [
575 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tbody td .amount' => 'color: {{VALUE}} !important',
576 ],
577 ]
578 );
579 $this->add_responsive_control(
580 'table_body_data_padding',
581 [
582 'label' => esc_html__('Row Padding ', 'ultimate-store-kit'),
583 'type' => Controls_Manager::DIMENSIONS,
584 'selectors' => [
585 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table:not(.shipping__table--multiple) > tbody > tr > td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
586 ],
587 ]
588 );
589
590 $this->add_group_control(
591 Group_Control_Typography::get_type(),
592 [
593 'name' => 'orders_body_typography',
594 'label' => esc_html__(' Typography', 'ultimate-store-kit'),
595 'selector' => '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tbody :is(td, label, .amount, strong, bdi)',
596 ]
597 );
598 $this->end_controls_tab();
599 $this->start_controls_tab(
600 'tab_table_footer',
601 [
602 'label' => __('FOOTER', 'ultimate-store-kit'),
603 ]
604 );
605 $this->add_control(
606 'footer_text_color',
607 [
608 'label' => esc_html__('Text Color', 'ultimate-store-kit'),
609 'type' => Controls_Manager::COLOR,
610 'selectors' => [
611 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot :is(th, td, label)' => 'color: {{VALUE}} !important'
612 ],
613 ]
614 );
615
616 $this->add_control(
617 'footer_price_color',
618 [
619 'label' => esc_html__('Price Color', 'ultimate-store-kit'),
620 'type' => Controls_Manager::COLOR,
621
622 'selectors' => [
623 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot :is(th, td) .amount' => 'color: {{VALUE}} !important'
624 ],
625 ]
626 );
627 $this->add_control(
628 'footer_subtotal_bg_color',
629 [
630 'label' => esc_html__('Subtotal Background Color', 'ultimate-store-kit'),
631 'type' => Controls_Manager::COLOR,
632 'selectors' => [
633 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot .cart-subtotal' => 'background-color: {{VALUE}} !important'
634 ],
635 ]
636 );
637
638 $this->add_control(
639 'footer_total_bg_color',
640 [
641 'label' => esc_html__('Total Background Color', 'ultimate-store-kit'),
642 'type' => Controls_Manager::COLOR,
643
644 'selectors' => [
645 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot .order-total' => 'background-color: {{VALUE}} !important'
646 ],
647 ]
648 );
649
650 $this->add_responsive_control(
651 'table_footer_data_padding',
652 [
653 'label' => esc_html__('Padding ', 'ultimate-store-kit'),
654 'type' => Controls_Manager::DIMENSIONS,
655 'selectors' => [
656 '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot :is(th, td, label)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
657 '.rtl {{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot :is(th, td, label)' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;',
658 ],
659 'separator' => 'after'
660 ]
661 );
662
663 $this->add_group_control(
664 Group_Control_Typography::get_type(),
665 [
666 'name' => 'footer_color_typography',
667 'label' => esc_html__('Text Typography', 'ultimate-store-kit'),
668 'selector' => '{{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot th,
669 {{WRAPPER}} .usk-checkout-order-review .woocommerce-checkout-review-order-table tfoot td :is(label, .amount)',
670 ]
671 );
672 $this->end_controls_tab();
673 $this->end_controls_tabs();
674 $this->end_controls_section();
675
676
677 // $this->start_controls_section(
678 // 'checkout_payment_content_section',
679 // [
680 // 'label' => esc_html__('Content', 'ultimate-store-kit'),
681 // 'tab' => Controls_Manager::TAB_STYLE,
682 // ]
683 // );
684
685
686 // $this->end_controls_section();
687
688 $this->start_controls_section(
689 'checkout_payment_methods',
690 [
691 'label' => esc_html__('Payment Methods', 'ultimate-store-kit'),
692 'tab' => Controls_Manager::TAB_STYLE,
693 ]
694 );
695 $this->start_controls_tabs(
696 'tabs_checkout_payment_methods'
697 );
698 $this->start_controls_tab(
699 'tab_content_checkout_payment_method',
700 [
701 'label' => __('Content', 'ultimate-store-kit'),
702 ]
703 );
704 $this->add_control(
705 'checkout_payment_text_color',
706 [
707 'label' => esc_html__('Text Color', 'ultimate-store-kit'),
708 'type' => Controls_Manager::COLOR,
709 'selectors' => [
710 '{{WRAPPER}} .usk-checkout-payment #payment .payment_methods .payment_box' => 'color: {{VALUE}};',
711 '{{WRAPPER}} .usk-checkout-payment #payment .payment_methods .payment_box p' => 'color: {{VALUE}};',
712 '{{WRAPPER}} .usk-checkout-payment #payment .payment_methods .payment_box a' => 'color: {{VALUE}};',
713 '{{WRAPPER}} .usk-checkout-payment #payment .woocommerce-privacy-policy-text p' => 'color: {{VALUE}};',
714 ],
715 ]
716 );
717
718 $this->add_control(
719 'checkout_payment_link_color',
720 [
721 'label' => esc_html__('Link Color', 'ultimate-store-kit'),
722 'type' => Controls_Manager::COLOR,
723 'selectors' => [
724 '{{WRAPPER}} .usk-checkout-payment a' => 'color: {{VALUE}};',
725 ],
726 ]
727 );
728
729 $this->add_control(
730 'checkout_payment_link_hover_color',
731 [
732 'label' => esc_html__('Link hover Color', 'ultimate-store-kit'),
733 'type' => Controls_Manager::COLOR,
734 'selectors' => [
735 '{{WRAPPER}} .usk-checkout-payment a:hover' => 'color: {{VALUE}};',
736 ],
737 ]
738 );
739
740 $this->add_group_control(
741 Group_Control_Typography::get_type(),
742 [
743 'name' => 'checkout_payment_content_typography',
744 'label' => esc_html__('Typography', 'ultimate-store-kit'),
745 'selector' => '{{WRAPPER}} .usk-checkout-payment #payment :is(.payment_box, .woocommerce-terms-and-conditions-wrapper, .payment_method_paypal) :is(p, a)',
746 ]
747 );
748 $this->add_control(
749 'checkout_payment_method_radio_input_color',
750 [
751 'label' => esc_html__('Checked Color', 'ultimate-store-kit'),
752 'type' => Controls_Manager::COLOR,
753 'selectors' => [
754 '{{WRAPPER}} .usk-checkout-payment #payment .wc_payment_method input[type="radio"]' => 'accent-color: {{VALUE}};',
755 ],
756 ]
757 );
758 $this->add_control(
759 'checkout_payment_label_color',
760 [
761 'label' => esc_html__('Label Color', 'ultimate-store-kit'),
762 'type' => Controls_Manager::COLOR,
763 'selectors' => [
764 '{{WRAPPER}} .usk-checkout-payment .wc_payment_method label' => 'color: {{VALUE}} !important;',
765 ],
766 ]
767 );
768
769 $this->add_control(
770 'checkout_payment_background_color',
771 [
772 'label' => esc_html__('Background Color', 'ultimate-store-kit'),
773 'type' => Controls_Manager::COLOR,
774 'selectors' => [
775 '{{WRAPPER}} .usk-page-checkout #payment .wc_payment_methods li.wc_payment_method input[type="radio"]:checked + label, {{WRAPPER}} .usk-page-checkout #payment .wc_payment_methods li.wc_payment_method .payment_box' => 'background-color: {{VALUE}};',
776 ],
777 ]
778 );
779
780 $this->add_responsive_control(
781 'checkout_payment_methods_checkbox_padding',
782 [
783 'label' => esc_html__('Padding', 'ultimate-store-kit'),
784 'type' => Controls_Manager::DIMENSIONS,
785 'separator' => 'before',
786 'selectors' => [
787 '{{WRAPPER}} .usk-page-checkout #payment .wc_payment_methods li.wc_payment_method input[type="radio"]:checked + label, {{WRAPPER}} .usk-page-checkout #payment .wc_payment_methods li.wc_payment_method .payment_box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
788 ],
789 ]
790 );
791
792 $this->add_responsive_control(
793 'checkout_payment_methods_checkbox_margin',
794 [
795 'label' => esc_html__('Margin', 'ultimate-store-kit'),
796 'type' => Controls_Manager::DIMENSIONS,
797 'selectors' => [
798 '{{WRAPPER}} .usk-checkout-payment #payment .wc_payment_method input[type="radio"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
799 ],
800 ]
801 );
802
803 $this->add_group_control(
804 Group_Control_Border::get_type(),
805 [
806 'name' => 'checkout_payment_methods_border',
807 'label' => esc_html__('Border', 'ultimate-store-kit'),
808 'selector' => '{{WRAPPER}} .usk-checkout-payment #payment .payment_methods li',
809 'separator' => 'before',
810 ]
811 );
812
813 $this->add_responsive_control(
814 'checkout_payment_methods_radius',
815 [
816 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
817 'type' => Controls_Manager::DIMENSIONS,
818 'selectors' => [
819 '{{WRAPPER}} .usk-checkout-payment #payment .payment_methods li' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
820 ],
821 ]
822 );
823
824 $this->add_responsive_control(
825 'checkout_payment_methods_checkbox_spacing',
826 [
827 'label' => __('Bottom Spacing', 'ultimate-store-kit'),
828 'type' => Controls_Manager::SLIDER,
829 'separator' => 'before',
830 'selectors' => [
831 '{{WRAPPER}} .usk-checkout-payment #payment .payment_methods li' => 'margin-bottom: {{SIZE}}{{UNIT}};',
832 ],
833 ]
834 );
835
836 $this->add_group_control(
837 Group_Control_Typography::get_type(),
838 [
839 'name' => 'checkout_payment_label_typography',
840 'label' => esc_html__('Typography', 'ultimate-store-kit'),
841 'selector' => '{{WRAPPER}} .usk-checkout-payment .wc_payment_method label',
842 ]
843 );
844 $this->end_controls_tab();
845 $this->start_controls_tab(
846 'tab_button_checkout_payment_method',
847 [
848 'label' => __('Button', 'ultimate-store-kit'),
849 ]
850 );
851 $this->add_control(
852 'checkout_payment_order_button_color',
853 [
854 'label' => esc_html__('Color', 'ultimate-store-kit'),
855 'type' => Controls_Manager::COLOR,
856 'selectors' => [
857 '{{WRAPPER}} .usk-checkout-payment #payment #place_order' => 'color: {{VALUE}}',
858 ],
859 ]
860 );
861
862 $this->add_control(
863 'checkout_payment_order_button_background',
864 [
865 'label' => esc_html__('Background', 'ultimate-store-kit'),
866 'type' => Controls_Manager::COLOR,
867 'selectors' => [
868 '{{WRAPPER}} .usk-checkout-payment #payment #place_order' => 'background: {{VALUE}}',
869 ],
870 ]
871 );
872
873 $this->add_responsive_control(
874 'checkout_payment_order_button_padding',
875 [
876 'label' => esc_html__('Padding', 'ultimate-store-kit'),
877 'type' => Controls_Manager::DIMENSIONS,
878 'selectors' => [
879 '{{WRAPPER}} .usk-checkout-payment #payment #place_order' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
880 ],
881 'separator' => 'before',
882 ]
883 );
884
885 $this->add_group_control(
886 Group_Control_Border::get_type(),
887 [
888 'name' => 'checkout_payment_input_border',
889 'label' => esc_html__('Border', 'ultimate-store-kit'),
890 'selector' => '{{WRAPPER}} .usk-checkout-payment #payment #place_order',
891 ]
892 );
893
894
895 $this->add_control(
896 'checkout_payment_order_button_radius',
897 [
898 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
899 'type' => Controls_Manager::DIMENSIONS,
900 'selectors' => [
901 '{{WRAPPER}} .usk-checkout-payment #payment #place_order' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
902 ],
903 ]
904 );
905
906 $this->add_group_control(
907 Group_Control_Typography::get_type(),
908 [
909 'name' => 'checkout_payment_order_button_typography',
910 'label' => esc_html__('Typography', 'ultimate-store-kit'),
911 'selector' => '{{WRAPPER}} .usk-checkout-payment #payment #place_order',
912 ]
913 );
914 $this->add_control(
915 'heading_button_hover',
916 [
917 'label' => __('H O V E R', 'ultimate-store-kit'),
918 'type' => Controls_Manager::HEADING,
919 'separator' => 'before',
920 ]
921 );
922 $this->add_control(
923 'checkout_payment_order_button_tabs_hover_clr',
924 [
925 'label' => esc_html__('Color', 'ultimate-store-kit'),
926 'type' => Controls_Manager::COLOR,
927 'selectors' => [
928 '{{WRAPPER}} .usk-checkout-payment #payment #place_order:hover' => 'color: {{VALUE}}',
929 ],
930 ]
931 );
932
933 $this->add_control(
934 'checkout_payment_order_button_tabs_hover_bg',
935 [
936 'label' => esc_html__('Background', 'ultimate-store-kit'),
937 'type' => Controls_Manager::COLOR,
938 'selectors' => [
939 '{{WRAPPER}} .usk-checkout-payment #payment #place_order:hover' => 'background: {{VALUE}}',
940 ],
941 ]
942 );
943 $this->end_controls_tab();
944 $this->end_controls_tabs();
945 $this->end_controls_section();
946 }
947
948 protected function checkout_payment_methods()
949 {
950
951 ?>
952 <div class="usk-checkout-payment">
953 <?php if (Plugin::instance()->editor->is_edit_mode()) {
954 woocommerce_checkout_payment();
955 } else {
956 if (!empty(WC()->cart) && !WC()->cart->is_empty()) {
957 woocommerce_checkout_payment();
958 }
959 }
960 ?>
961 </div>
962 <?php
963
964 }
965 public function checkout_shipping_form( $settings )
966 {
967 $checkout = WC()->checkout();
968 if (Plugin::instance()->editor->is_edit_mode()) {
969 $screen_check = true;
970 } else {
971 $screen_check = WC()->cart->needs_shipping_address();
972 }
973 ?>
974 <div class="usk-checkout-shipping-form">
975 <div class="woocommerce-shipping-fields">
976 <?php if (true === $screen_check): ?>
977 <h3 id="ship-to-different-address">
978 <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
979 <input id="ship-to-different-address-checkbox"
980 class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" <?php checked(apply_filters('woocommerce_ship_to_different_address_checked', 'shipping' === get_option('woocommerce_ship_to_destination') ? 1 : 0), 1); ?> type="checkbox"
981 name="ship_to_different_address" value="1" />
982 <span>
983 <?php
984 $label = !empty($settings['text_ship_to_different_address'])
985 ? $settings['text_ship_to_different_address']
986 : __('Ship to a different address?', 'ultimate-store-kit');
987 echo esc_html($label);
988 ?>
989 </span>
990 </label>
991 </h3>
992 <div class="shipping_address">
993 <?php do_action('woocommerce_before_checkout_shipping_form', $checkout); ?>
994 <div class="woocommerce-shipping-fields__field-wrapper">
995 <?php $fields = $checkout->get_checkout_fields('shipping');
996 foreach ($fields as $key => $field) {
997 woocommerce_form_field($key, $field, $checkout->get_value($key));
998 } ?>
999 </div>
1000 <?php do_action('woocommerce_after_checkout_shipping_form', $checkout); ?>
1001 </div>
1002 <?php endif;
1003 ?>
1004 </div>
1005 </div>
1006 <?php
1007 }
1008 protected function checkout_billing_address( $settings )
1009 {
1010 $checkout = WC()->checkout(); ?>
1011
1012 <div class="usk-checkout-billing-address">
1013 <div class="woocommerce-billing-fields">
1014
1015 <?php if (wc_ship_to_billing_address_only() && WC()->cart->needs_shipping()): ?>
1016 <h3 class="usk-checkout-billing-address-header">
1017 <?php
1018 $heading = !empty($settings['text_billing_shipping_heading'])
1019 ? $settings['text_billing_shipping_heading']
1020 : __('Billing & Shipping', 'ultimate-store-kit');
1021 echo esc_html($heading);
1022 ?>
1023 </h3>
1024 <?php else: ?>
1025 <h3 class="usk-checkout-billing-address-header">
1026 <?php
1027 $heading = !empty($settings['text_billing_details_heading'])
1028 ? $settings['text_billing_details_heading']
1029 : __('Billing details', 'ultimate-store-kit');
1030 echo esc_html($heading);
1031 ?>
1032 </h3>
1033 <?php endif; ?>
1034 <?php do_action('woocommerce_before_checkout_billing_form', $checkout); ?>
1035
1036 <div class="woocommerce-billing-fields__field-wrapper">
1037 <?php $fields = $checkout->get_checkout_fields('billing');
1038 foreach ($fields as $key => $field) {
1039 woocommerce_form_field($key, $field, $checkout->get_value($key));
1040 } ?>
1041
1042 </div>
1043
1044 <?php do_action('woocommerce_after_checkout_billing_form', $checkout); ?>
1045
1046 </div>
1047
1048 <?php if (!is_user_logged_in() && $checkout->is_registration_enabled()): ?>
1049 <div class="woocommerce-account-fields">
1050 <?php if (!$checkout->is_registration_required()): ?>
1051
1052 <p class="form-row form-row-wide create-account">
1053 <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
1054 <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox"
1055 id="createaccount" <?php checked((true === $checkout->get_value('createaccount') || (true === apply_filters('woocommerce_create_account_default_checked', false))), true); ?>
1056 type="checkbox" name="createaccount" value="1" />
1057 <span>
1058 <?php
1059 $label = !empty($settings['text_create_account'])
1060 ? $settings['text_create_account']
1061 : __('Create an account?', 'ultimate-store-kit');
1062 echo esc_html($label);
1063 ?>
1064 </span>
1065 </label>
1066 </p>
1067
1068 <?php endif; ?>
1069
1070 <?php do_action('woocommerce_before_checkout_registration_form', $checkout); ?>
1071
1072 <?php if ($checkout->get_checkout_fields('account')): ?>
1073
1074 <div class="create-account">
1075 <?php foreach ($checkout->get_checkout_fields('account') as $key => $field): ?>
1076 <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?>
1077 <?php endforeach; ?>
1078 <div class="clear"></div>
1079 </div>
1080
1081 <?php endif; ?>
1082
1083 <?php do_action('woocommerce_after_checkout_registration_form', $checkout); ?>
1084 </div>
1085 <?php endif; ?>
1086 </div>
1087 <?php
1088 }
1089
1090 public function checkout_order_review( $settings )
1091 {
1092 ?>
1093 <div class="usk-checkout-order-review">
1094 <h3 id="order_review_heading" class="order_review_heading">
1095 <?php
1096 $heading = !empty($settings['text_order_review_heading'])
1097 ? $settings['text_order_review_heading']
1098 : __('Your order', 'ultimate-store-kit');
1099 echo esc_html($heading);
1100 ?>
1101 </h3>
1102 <div id="order_review" class="woocommerce-checkout-review-order">
1103 <?php do_action('woocommerce_checkout_before_order_review'); ?>
1104 <?php
1105 global $wp;
1106 if (isset($wp->query_vars['order-pay'])) {
1107 \WC_Shortcode_Checkout::output([]);
1108 } else {
1109 woocommerce_order_review();
1110 }
1111
1112 ?>
1113 </div>
1114 <?php do_action('woocommerce_checkout_after_order_review'); ?>
1115 </div>
1116 <?php
1117 }
1118 public function render()
1119 {
1120 // Initialize WC cart in editor
1121 if (Plugin::instance()->editor->is_edit_mode() && function_exists('WC')) {
1122 WC()->frontend_includes();
1123 WC()->initialize_session();
1124 WC()->initialize_cart();
1125 }
1126
1127 $settings = $this->get_settings_for_display();
1128 ?>
1129
1130 <div class="usk-page-checkout">
1131 <div class="usk-checkout-address-wrapper">
1132 <?php $this->checkout_billing_address( $settings ); ?>
1133 <?php
1134 if (!empty($settings['show_shipping_form']) && $settings['show_shipping_form'] === 'yes') {
1135 $this->checkout_shipping_form( $settings );
1136 }
1137 ?>
1138 </div>
1139 <div class="usk-checkout-details-wrapper">
1140 <?php $this->checkout_order_review( $settings ); ?>
1141 <?php $this->checkout_payment_methods(); ?>
1142 </div>
1143 </div>
1144
1145 <?php
1146 }
1147 }
1148