PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.82
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.82
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / widgets / Woo_Shortcode_Checkout / Woo_Shortcode_Checkout.php

Woo_Shortcode_Checkout.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.82, at includes/widgets/Woo_Shortcode_Checkout/Woo_Shortcode_Checkout.php

715 lines 23.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Woo Shortcode Checkout widget.
4 * Renders the standard WooCommerce [woocommerce_checkout] shortcode.
5 *
6 * @package King_Addons
7 */
8
9 namespace King_Addons;
10
11 use Elementor\Controls_Manager;
12 use Elementor\Group_Control_Typography;
13 use Elementor\Group_Control_Border;
14 use Elementor\Group_Control_Box_Shadow;
15 use Elementor\Widget_Base;
16
17 if (!defined('ABSPATH')) {
18 exit;
19 }
20
21 /**
22 * Displays WooCommerce checkout using the standard shortcode.
23 */
24 class Woo_Shortcode_Checkout extends Widget_Base
25 {
26 /**
27 * Get widget name.
28 *
29 * @return string
30 */
31 public function get_name(): string
32 {
33 return 'woo_shortcode_checkout';
34 }
35
36 /**
37 * Get widget title.
38 *
39 * @return string
40 */
41 public function get_title(): string
42 {
43 return esc_html__('WC Checkout', 'king-addons');
44 }
45
46 /**
47 * Get widget icon.
48 *
49 * @return string
50 */
51 public function get_icon(): string
52 {
53 return 'king-addons-icon king-addons-woo-shortcode-checkout';
54 }
55
56 /**
57 * Get widget categories.
58 *
59 * @return array<int,string>
60 */
61 public function get_categories(): array
62 {
63 return ['king-addons-woo'];
64 }
65
66 /**
67 * Get widget keywords.
68 *
69 * @return array<int,string>
70 */
71 public function get_keywords(): array
72 {
73 return ['woocommerce', 'checkout', 'shortcode', 'payment', 'order'];
74 }
75
76 /**
77 * Register controls.
78 *
79 * @return void
80 */
81 public function get_custom_help_url()
82 {
83 return 'mailto:bug@kingaddons.com?subject=Bug Report - King Addons&body=Please describe the issue';
84 }
85
86 protected function register_controls(): void
87 {
88 $this->start_controls_section(
89 'section_info',
90 [
91 'label' => esc_html__('Info', 'king-addons'),
92 'tab' => Controls_Manager::TAB_CONTENT,
93 ]
94 );
95
96 $this->add_control(
97 'info_notice',
98 [
99 'type' => Controls_Manager::RAW_HTML,
100 'raw' => sprintf(
101 '<div style="padding: 15px; background: #f0f6fc; border-left: 4px solid #2271b1; border-radius: 4px; color: #1d4ed8;">
102 <strong>%s</strong><br><br>%s
103 </div>',
104 esc_html__('WooCommerce Checkout Shortcode', 'king-addons'),
105 esc_html__('This widget renders the standard WooCommerce checkout page using the [woocommerce_checkout] shortcode. It displays the full checkout form with billing, shipping, payment methods, and order review.', 'king-addons')
106 ),
107 'content_classes' => 'elementor-panel-alert',
108 ]
109 );
110
111 $this->end_controls_section();
112
113 // =============================================
114 // STYLE TAB
115 // =============================================
116
117 // Section Titles Style
118 $this->start_controls_section(
119 'section_style_headings',
120 [
121 'label' => esc_html__('Section Headings', 'king-addons'),
122 'tab' => Controls_Manager::TAB_STYLE,
123 ]
124 );
125
126 $this->add_control(
127 'heading_color',
128 [
129 'label' => esc_html__('Color', 'king-addons'),
130 'type' => Controls_Manager::COLOR,
131 'selectors' => [
132 '{{WRAPPER}} .woocommerce-checkout h3' => 'color: {{VALUE}};',
133 '{{WRAPPER}} #order_review_heading' => 'color: {{VALUE}};',
134 ],
135 ]
136 );
137
138 $this->add_group_control(
139 Group_Control_Typography::get_type(),
140 [
141 'name' => 'heading_typography',
142 'selector' => '{{WRAPPER}} .woocommerce-checkout h3, {{WRAPPER}} #order_review_heading',
143 ]
144 );
145
146 $this->add_responsive_control(
147 'heading_spacing',
148 [
149 'label' => esc_html__('Spacing', 'king-addons'),
150 'type' => Controls_Manager::SLIDER,
151 'size_units' => ['px', 'em'],
152 'selectors' => [
153 '{{WRAPPER}} .woocommerce-checkout h3' => 'margin-bottom: {{SIZE}}{{UNIT}};',
154 '{{WRAPPER}} #order_review_heading' => 'margin-bottom: {{SIZE}}{{UNIT}};',
155 ],
156 ]
157 );
158
159 $this->end_controls_section();
160
161 // Form Labels Style
162 $this->start_controls_section(
163 'section_style_labels',
164 [
165 'label' => esc_html__('Form Labels', 'king-addons'),
166 'tab' => Controls_Manager::TAB_STYLE,
167 ]
168 );
169
170 $this->add_control(
171 'label_color',
172 [
173 'label' => esc_html__('Color', 'king-addons'),
174 'type' => Controls_Manager::COLOR,
175 'selectors' => [
176 '{{WRAPPER}} form.woocommerce-checkout label' => 'color: {{VALUE}};',
177 '{{WRAPPER}} .woocommerce-checkout form label' => 'color: {{VALUE}};',
178 ],
179 ]
180 );
181
182 $this->add_group_control(
183 Group_Control_Typography::get_type(),
184 [
185 'name' => 'label_typography',
186 'selector' => '{{WRAPPER}} form.woocommerce-checkout label, {{WRAPPER}} .woocommerce-checkout form label',
187 ]
188 );
189
190 $this->add_control(
191 'required_color',
192 [
193 'label' => esc_html__('Required Asterisk Color', 'king-addons'),
194 'type' => Controls_Manager::COLOR,
195 'selectors' => [
196 '{{WRAPPER}} form.woocommerce-checkout label .required' => 'color: {{VALUE}};',
197 '{{WRAPPER}} .woocommerce-checkout form label .required' => 'color: {{VALUE}};',
198 ],
199 ]
200 );
201
202 $this->end_controls_section();
203
204 // Form Fields Style
205 $this->start_controls_section(
206 'section_style_fields',
207 [
208 'label' => esc_html__('Form Fields', 'king-addons'),
209 'tab' => Controls_Manager::TAB_STYLE,
210 ]
211 );
212
213 $this->add_control(
214 'field_bg_color',
215 [
216 'label' => esc_html__('Background Color', 'king-addons'),
217 'type' => Controls_Manager::COLOR,
218 'selectors' => [
219 '{{WRAPPER}} .woocommerce-checkout input.input-text' => 'background-color: {{VALUE}};',
220 '{{WRAPPER}} .woocommerce-checkout textarea' => 'background-color: {{VALUE}};',
221 '{{WRAPPER}} .woocommerce-checkout select' => 'background-color: {{VALUE}};',
222 ],
223 ]
224 );
225
226 $this->add_control(
227 'field_text_color',
228 [
229 'label' => esc_html__('Text Color', 'king-addons'),
230 'type' => Controls_Manager::COLOR,
231 'selectors' => [
232 '{{WRAPPER}} .woocommerce-checkout input.input-text' => 'color: {{VALUE}};',
233 '{{WRAPPER}} .woocommerce-checkout textarea' => 'color: {{VALUE}};',
234 '{{WRAPPER}} .woocommerce-checkout select' => 'color: {{VALUE}};',
235 ],
236 ]
237 );
238
239 $this->add_control(
240 'field_placeholder_color',
241 [
242 'label' => esc_html__('Placeholder Color', 'king-addons'),
243 'type' => Controls_Manager::COLOR,
244 'selectors' => [
245 '{{WRAPPER}} .woocommerce-checkout input.input-text::placeholder' => 'color: {{VALUE}};',
246 '{{WRAPPER}} .woocommerce-checkout textarea::placeholder' => 'color: {{VALUE}};',
247 ],
248 ]
249 );
250
251 $this->add_group_control(
252 Group_Control_Border::get_type(),
253 [
254 'name' => 'field_border',
255 'selector' => '{{WRAPPER}} .woocommerce-checkout input.input-text, {{WRAPPER}} .woocommerce-checkout textarea, {{WRAPPER}} .woocommerce-checkout select',
256 ]
257 );
258
259 $this->add_responsive_control(
260 'field_border_radius',
261 [
262 'label' => esc_html__('Border Radius', 'king-addons'),
263 'type' => Controls_Manager::DIMENSIONS,
264 'size_units' => ['px', '%'],
265 'selectors' => [
266 '{{WRAPPER}} .woocommerce-checkout input.input-text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
267 '{{WRAPPER}} .woocommerce-checkout textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
268 '{{WRAPPER}} .woocommerce-checkout select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
269 ],
270 ]
271 );
272
273 $this->add_responsive_control(
274 'field_padding',
275 [
276 'label' => esc_html__('Padding', 'king-addons'),
277 'type' => Controls_Manager::DIMENSIONS,
278 'size_units' => ['px', 'em'],
279 'selectors' => [
280 '{{WRAPPER}} .woocommerce-checkout input.input-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
281 '{{WRAPPER}} .woocommerce-checkout textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
282 '{{WRAPPER}} .woocommerce-checkout select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
283 ],
284 ]
285 );
286
287 $this->end_controls_section();
288
289 // Order Review Table Style
290 $this->start_controls_section(
291 'section_style_order_review',
292 [
293 'label' => esc_html__('Order Review Table', 'king-addons'),
294 'tab' => Controls_Manager::TAB_STYLE,
295 ]
296 );
297
298 $this->add_control(
299 'order_review_bg_color',
300 [
301 'label' => esc_html__('Background Color', 'king-addons'),
302 'type' => Controls_Manager::COLOR,
303 'selectors' => [
304 '{{WRAPPER}} #order_review' => 'background-color: {{VALUE}};',
305 ],
306 ]
307 );
308
309 $this->add_responsive_control(
310 'order_review_padding',
311 [
312 'label' => esc_html__('Padding', 'king-addons'),
313 'type' => Controls_Manager::DIMENSIONS,
314 'size_units' => ['px', 'em'],
315 'selectors' => [
316 '{{WRAPPER}} #order_review' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
317 ],
318 ]
319 );
320
321 $this->add_group_control(
322 Group_Control_Border::get_type(),
323 [
324 'name' => 'order_review_border',
325 'selector' => '{{WRAPPER}} #order_review',
326 ]
327 );
328
329 $this->add_responsive_control(
330 'order_review_border_radius',
331 [
332 'label' => esc_html__('Border Radius', 'king-addons'),
333 'type' => Controls_Manager::DIMENSIONS,
334 'size_units' => ['px', '%'],
335 'selectors' => [
336 '{{WRAPPER}} #order_review' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
337 ],
338 ]
339 );
340
341 $this->end_controls_section();
342
343 // Payment Methods Style
344 $this->start_controls_section(
345 'section_style_payment',
346 [
347 'label' => esc_html__('Payment Methods', 'king-addons'),
348 'tab' => Controls_Manager::TAB_STYLE,
349 ]
350 );
351
352 $this->add_control(
353 'payment_bg_color',
354 [
355 'label' => esc_html__('Background Color', 'king-addons'),
356 'type' => Controls_Manager::COLOR,
357 'selectors' => [
358 '{{WRAPPER}} #payment' => 'background-color: {{VALUE}};',
359 ],
360 ]
361 );
362
363 $this->add_control(
364 'payment_label_color',
365 [
366 'label' => esc_html__('Label Color', 'king-addons'),
367 'type' => Controls_Manager::COLOR,
368 'selectors' => [
369 '{{WRAPPER}} #payment .wc_payment_method label' => 'color: {{VALUE}};',
370 ],
371 ]
372 );
373
374 $this->add_group_control(
375 Group_Control_Typography::get_type(),
376 [
377 'name' => 'payment_label_typography',
378 'selector' => '{{WRAPPER}} #payment .wc_payment_method label',
379 ]
380 );
381
382 $this->add_responsive_control(
383 'payment_padding',
384 [
385 'label' => esc_html__('Padding', 'king-addons'),
386 'type' => Controls_Manager::DIMENSIONS,
387 'size_units' => ['px', 'em'],
388 'selectors' => [
389 '{{WRAPPER}} #payment' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
390 ],
391 ]
392 );
393
394 $this->add_responsive_control(
395 'payment_border_radius',
396 [
397 'label' => esc_html__('Border Radius', 'king-addons'),
398 'type' => Controls_Manager::DIMENSIONS,
399 'size_units' => ['px', '%'],
400 'selectors' => [
401 '{{WRAPPER}} #payment' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
402 ],
403 ]
404 );
405
406 $this->add_group_control(
407 Group_Control_Border::get_type(),
408 [
409 'name' => 'payment_border',
410 'selector' => '{{WRAPPER}} #payment',
411 ]
412 );
413
414 $this->end_controls_section();
415
416 // Order Table Style
417 $this->start_controls_section(
418 'section_style_order_table',
419 [
420 'label' => esc_html__('Order Table', 'king-addons'),
421 'tab' => Controls_Manager::TAB_STYLE,
422 ]
423 );
424
425 $this->add_control(
426 'order_table_header_color',
427 [
428 'label' => esc_html__('Header Text Color', 'king-addons'),
429 'type' => Controls_Manager::COLOR,
430 'selectors' => [
431 '{{WRAPPER}} .woocommerce-checkout-review-order-table th' => 'color: {{VALUE}};',
432 ],
433 ]
434 );
435
436 $this->add_control(
437 'order_table_header_bg',
438 [
439 'label' => esc_html__('Header Background', 'king-addons'),
440 'type' => Controls_Manager::COLOR,
441 'selectors' => [
442 '{{WRAPPER}} .woocommerce-checkout-review-order-table th' => 'background-color: {{VALUE}};',
443 ],
444 ]
445 );
446
447 $this->add_control(
448 'order_table_cell_color',
449 [
450 'label' => esc_html__('Cell Text Color', 'king-addons'),
451 'type' => Controls_Manager::COLOR,
452 'selectors' => [
453 '{{WRAPPER}} .woocommerce-checkout-review-order-table td' => 'color: {{VALUE}};',
454 ],
455 ]
456 );
457
458 $this->add_group_control(
459 Group_Control_Border::get_type(),
460 [
461 'name' => 'order_table_border',
462 'selector' => '{{WRAPPER}} .woocommerce-checkout-review-order-table, {{WRAPPER}} .woocommerce-checkout-review-order-table th, {{WRAPPER}} .woocommerce-checkout-review-order-table td',
463 ]
464 );
465
466 $this->add_responsive_control(
467 'order_table_padding',
468 [
469 'label' => esc_html__('Cell Padding', 'king-addons'),
470 'type' => Controls_Manager::DIMENSIONS,
471 'size_units' => ['px', 'em'],
472 'selectors' => [
473 '{{WRAPPER}} .woocommerce-checkout-review-order-table th' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
474 '{{WRAPPER}} .woocommerce-checkout-review-order-table td' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
475 ],
476 ]
477 );
478
479 $this->end_controls_section();
480
481 // Form Rows Style
482 $this->start_controls_section(
483 'section_style_form_rows',
484 [
485 'label' => esc_html__('Form Rows', 'king-addons'),
486 'tab' => Controls_Manager::TAB_STYLE,
487 ]
488 );
489
490 $this->add_responsive_control(
491 'form_row_spacing',
492 [
493 'label' => esc_html__('Row Spacing', 'king-addons'),
494 'type' => Controls_Manager::SLIDER,
495 'size_units' => ['px', 'em'],
496 'range' => [
497 'px' => [
498 'min' => 0,
499 'max' => 50,
500 ],
501 ],
502 'selectors' => [
503 '{{WRAPPER}} .woocommerce-checkout .form-row' => 'margin-bottom: {{SIZE}}{{UNIT}};',
504 ],
505 ]
506 );
507
508 $this->add_responsive_control(
509 'form_row_gap',
510 [
511 'label' => esc_html__('Column Gap', 'king-addons'),
512 'type' => Controls_Manager::SLIDER,
513 'size_units' => ['px', 'em'],
514 'range' => [
515 'px' => [
516 'min' => 0,
517 'max' => 50,
518 ],
519 ],
520 'selectors' => [
521 '{{WRAPPER}} .woocommerce-checkout .form-row-first' => 'padding-right: {{SIZE}}{{UNIT}};',
522 '{{WRAPPER}} .woocommerce-checkout .form-row-last' => 'padding-left: {{SIZE}}{{UNIT}};',
523 ],
524 ]
525 );
526
527 $this->end_controls_section();
528
529 // Place Order Button Style
530 $this->start_controls_section(
531 'section_style_place_order',
532 [
533 'label' => esc_html__('Place Order Button', 'king-addons'),
534 'tab' => Controls_Manager::TAB_STYLE,
535 ]
536 );
537
538 $this->start_controls_tabs('place_order_tabs');
539
540 $this->start_controls_tab(
541 'place_order_normal',
542 [
543 'label' => esc_html__('Normal', 'king-addons'),
544 ]
545 );
546
547 $this->add_control(
548 'place_order_text_color',
549 [
550 'label' => esc_html__('Text Color', 'king-addons'),
551 'type' => Controls_Manager::COLOR,
552 'selectors' => [
553 '{{WRAPPER}} #place_order' => 'color: {{VALUE}};',
554 ],
555 ]
556 );
557
558 $this->add_control(
559 'place_order_bg_color',
560 [
561 'label' => esc_html__('Background Color', 'king-addons'),
562 'type' => Controls_Manager::COLOR,
563 'selectors' => [
564 '{{WRAPPER}} #place_order' => 'background-color: {{VALUE}};',
565 ],
566 ]
567 );
568
569 $this->end_controls_tab();
570
571 $this->start_controls_tab(
572 'place_order_hover',
573 [
574 'label' => esc_html__('Hover', 'king-addons'),
575 ]
576 );
577
578 $this->add_control(
579 'place_order_hover_text_color',
580 [
581 'label' => esc_html__('Text Color', 'king-addons'),
582 'type' => Controls_Manager::COLOR,
583 'selectors' => [
584 '{{WRAPPER}} #place_order:hover' => 'color: {{VALUE}};',
585 ],
586 ]
587 );
588
589 $this->add_control(
590 'place_order_hover_bg_color',
591 [
592 'label' => esc_html__('Background Color', 'king-addons'),
593 'type' => Controls_Manager::COLOR,
594 'selectors' => [
595 '{{WRAPPER}} #place_order:hover' => 'background-color: {{VALUE}};',
596 ],
597 ]
598 );
599
600 $this->end_controls_tab();
601
602 $this->end_controls_tabs();
603
604 $this->add_group_control(
605 Group_Control_Typography::get_type(),
606 [
607 'name' => 'place_order_typography',
608 'selector' => '{{WRAPPER}} #place_order',
609 'separator' => 'before',
610 ]
611 );
612
613 $this->add_responsive_control(
614 'place_order_padding',
615 [
616 'label' => esc_html__('Padding', 'king-addons'),
617 'type' => Controls_Manager::DIMENSIONS,
618 'size_units' => ['px', 'em'],
619 'selectors' => [
620 '{{WRAPPER}} #place_order' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
621 ],
622 ]
623 );
624
625 $this->add_responsive_control(
626 'place_order_border_radius',
627 [
628 'label' => esc_html__('Border Radius', 'king-addons'),
629 'type' => Controls_Manager::DIMENSIONS,
630 'size_units' => ['px', '%'],
631 'selectors' => [
632 '{{WRAPPER}} #place_order' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
633 ],
634 ]
635 );
636
637 $this->add_group_control(
638 Group_Control_Border::get_type(),
639 [
640 'name' => 'place_order_border',
641 'selector' => '{{WRAPPER}} #place_order',
642 ]
643 );
644
645 $this->add_responsive_control(
646 'place_order_margin',
647 [
648 'label' => esc_html__('Margin', 'king-addons'),
649 'type' => Controls_Manager::DIMENSIONS,
650 'size_units' => ['px', 'em'],
651 'selectors' => [
652 '{{WRAPPER}} #place_order' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
653 ],
654 ]
655 );
656
657 $this->add_control(
658 'place_order_full_width',
659 [
660 'label' => esc_html__('Full Width', 'king-addons'),
661 'type' => Controls_Manager::SWITCHER,
662 'selectors' => [
663 '{{WRAPPER}} #place_order' => 'width: 100%;',
664 ],
665 ]
666 );
667
668 $this->end_controls_section();
669 }
670
671 /**
672 * Render widget output.
673 *
674 * @return void
675 */
676 protected function render(): void
677 {
678 if (!class_exists('WooCommerce')) {
679 if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
680 echo '<div class="king-addons-woo-builder-notice">' . esc_html__('WooCommerce is required for this widget.', 'king-addons') . '</div>';
681 }
682 return;
683 }
684
685 // The cart is not loaded on pages WooCommerce does not own, and the
686 // checkout shortcode returns an empty string without it - the visitor
687 // then sees a blank block. Load it in both contexts, not just the editor.
688 if (is_null(WC()->cart)) {
689 wc_load_cart();
690 }
691
692 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
693 $output = do_shortcode('[woocommerce_checkout]');
694
695 if ('' === trim(wp_strip_all_tags($output))) {
696 Core::renderEditorHint(
697 esc_html__('Checkout renders once the cart has items. Add a product to preview it.', 'king-addons')
698 );
699
700 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
701 echo wc_print_notice(
702 esc_html__('Checkout is not available whilst your cart is empty.', 'king-addons'),
703 'notice',
704 [],
705 true
706 );
707
708 return;
709 }
710
711 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
712 echo $output;
713 }
714 }
715