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 / mini-cart / widgets / mini-cart.php

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

1,388 lines 44.3 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\MiniCart\Widgets;
4
5 use UltimateStoreKit\Base\Module_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Group_Control_Background;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 class Mini_Cart extends Module_Base {
17
18 public function get_name() {
19 return 'usk-mini-cart';
20 }
21
22 public function get_title() {
23 return esc_html__( 'Mini Cart', 'ultimate-store-kit' );
24 }
25
26 public function get_icon() {
27 return 'usk-widget-icon usk-icon-mini-cart';
28 }
29
30 public function get_categories() {
31 return [ 'ultimate-store-kit' ];
32 }
33
34 public function get_keywords() {
35 return [ 'mini cart', 'cart', 'wc', 'woocommerce', 'add to cart' ];
36 }
37
38 public function get_style_depends() {
39 if ( $this->usk_is_edit_mode() ) {
40 return [ 'usk-all-styles' ];
41 } else {
42 return [ 'usk-font', 'usk-mini-cart', 'ultimate-store-kit-toolslide' ];
43 }
44 }
45
46 public function get_script_depends() {
47 if ( $this->usk_is_edit_mode() ) {
48 return [ 'ultimate-store-kit-toolslide', 'usk-site' ];
49 } else {
50 return [ 'ultimate-store-kit-toolslide', 'usk-mini-cart' ];
51 }
52 }
53
54 public function has_widget_inner_wrapper(): bool {
55 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
56 }
57 protected function is_dynamic_content(): bool {
58 return true;
59 }
60
61 protected function render_layout_controls_offcanvas() {
62 $this->start_controls_section(
63 'section_content_layout',
64 [
65 'label' => esc_html__( 'Offcanvas', 'ultimate-store-kit' ),
66 ]
67 );
68
69 $this->add_control(
70 'custom_widget_cart_title',
71 [
72 'label' => esc_html__( 'Cart Title', 'ultimate-store-kit' ),
73 'type' => Controls_Manager::TEXT,
74 'dynamic' => [ 'active' => true ],
75 'default' => esc_html__( 'Shopping Cart', 'ultimate-store-kit' ),
76 ]
77 );
78 $this->end_controls_section();
79 }
80 protected function render_controls_settings() {
81 $this->start_controls_section(
82 'section_content_mini_cart_settings',
83 [
84 'label' => esc_html__( 'Settings', 'ultimate-store-kit' ),
85 'tab' => Controls_Manager::TAB_CONTENT,
86 ]
87 );
88 $this->add_control(
89 'usk_mini_cart_position',
90 [
91 'label' => esc_html__( 'Position', 'ultimate-store-kit' ),
92 'type' => Controls_Manager::SELECT,
93 'options' => [
94 'left' => esc_html__( 'Left', 'ultimate-store-kit' ),
95 'right' => esc_html__( 'Right (Default)', 'ultimate-store-kit' ),
96 'bottom' => esc_html__( 'Bottom', 'ultimate-store-kit' ),
97 'top' => esc_html__( 'Top', 'ultimate-store-kit' ),
98 ],
99 'default' => 'right',
100 'dynamic' => [ 'active' => true ],
101 'render_type' => 'template',
102 'frontend_available' => true,
103 ]
104 );
105
106 $this->add_control(
107 'usk_mini_cart_height',
108 [
109 'label' => esc_html__( 'Height', 'ultimate-store-kit' ),
110 'type' => Controls_Manager::SLIDER,
111 'size_units' => [ 'px', '%', 'vh' ],
112 'range' => [
113 'px' => [
114 'min' => 0,
115 'max' => 1200,
116 'step' => 1,
117 ],
118 ],
119 'default' => [
120 'unit' => '%',
121 'size' => 100,
122 ],
123 'render_type' => 'none',
124 'frontend_available' => true,
125 ]
126 );
127
128 $this->add_control(
129 'usk_mini_cart_width',
130 [
131 'label' => esc_html__( 'Width', 'ultimate-store-kit' ),
132 'type' => Controls_Manager::SLIDER,
133 'size_units' => [ 'px', '%', 'vh' ],
134 'range' => [
135 'px' => [
136 'min' => 0,
137 'max' => 1200,
138 'step' => 1,
139 ],
140 ],
141 'default' => [
142 'unit' => 'px',
143 'size' => 340,
144 ],
145 'render_type' => 'none',
146 'frontend_available' => true,
147 ]
148 );
149 // $this->add_control(
150 // 'usk_mini_cart_closeable',
151 // [
152 // 'label' => esc_html__('Closeable', 'ultimate-store-kit'),
153 // 'type' => Controls_Manager::SWITCHER,
154 // 'label_on' => esc_html__('Yes', 'ultimate-store-kit'),
155 // 'label_off' => esc_html__('No', 'ultimate-store-kit'),
156 // 'render_type' => 'none',
157 // 'frontend_available' => true,
158 // ]
159 // );
160
161 $this->add_control(
162 'usk_mini_cart_startOpen',
163 [
164 'label' => esc_html__( 'Start Open', 'ultimate-store-kit' ),
165 'type' => Controls_Manager::SWITCHER,
166 'label_on' => esc_html__( 'Yes', 'ultimate-store-kit' ),
167 'label_off' => esc_html__( 'No', 'ultimate-store-kit' ),
168 'render_type' => 'none',
169 'frontend_available' => true,
170 ]
171 );
172
173 $this->add_control(
174 'usk_mini_cart_autoclose',
175 [
176 'label' => esc_html__( 'Auto close', 'ultimate-store-kit' ),
177 'type' => Controls_Manager::SWITCHER,
178 'label_on' => esc_html__( 'Yes', 'ultimate-store-kit' ),
179 'label_off' => esc_html__( 'No', 'ultimate-store-kit' ),
180 'render_type' => 'none',
181 'frontend_available' => true,
182 ]
183 );
184
185 $this->add_control(
186 'usk_mini_cart_clickOutsideToClose',
187 [
188 'label' => esc_html__( 'Click Outside To Close', 'ultimate-store-kit' ),
189 'type' => Controls_Manager::SWITCHER,
190 'label_on' => esc_html__( 'Yes', 'ultimate-store-kit' ),
191 'label_off' => esc_html__( 'No', 'ultimate-store-kit' ),
192 'render_type' => 'none',
193 'default' => 'yes',
194 'frontend_available' => true,
195 ]
196 );
197
198 $this->add_control(
199 'usk_mini_cart_autocloseDelay',
200 [
201 'label' => esc_html__( 'Auto Close Delay', 'ultimate-store-kit' ),
202 'description' => esc_html__( 'Description', 'ultimate-store-kit' ),
203 'type' => Controls_Manager::NUMBER,
204 'min' => 0,
205 'max' => 10000,
206 'step' => 1,
207 'default' => 5000,
208 'dynamic' => [ 'active' => true ],
209 'render_type' => 'none',
210 'frontend_available' => true,
211 ]
212 );
213 $this->end_controls_section();
214 }
215 protected function render_controls_mini_cart() {
216 $this->start_controls_section(
217 'section_content_mini_cart',
218 [
219 'label' => esc_html__( 'Mini Cart', 'ultimate-store-kit' ),
220 ]
221 );
222
223 $this->add_control(
224 'show_price_amount',
225 [
226 'label' => esc_html__( 'Show Price Amount', 'ultimate-store-kit' ),
227 'type' => Controls_Manager::SWITCHER,
228 'default' => 'yes',
229 'prefix_class' => 'wc-cart-price--',
230 ]
231 );
232
233 $this->add_control(
234 'show_cart_icon',
235 [
236 'label' => esc_html__( 'Show Cart Icon', 'ultimate-store-kit' ),
237 'type' => Controls_Manager::SWITCHER,
238 'default' => 'yes',
239 'prefix_class' => 'wc-cart-icon--',
240 ]
241 );
242 $this->add_responsive_control(
243 'mini_cart_align',
244 [
245 'label' => esc_html__( 'Alignment', 'ultimate-store-kit' ),
246 'type' => Controls_Manager::CHOOSE,
247 'options' => [
248 'left' => [
249 'title' => esc_html__( 'Left', 'ultimate-store-kit' ),
250 'icon' => 'eicon-h-align-left',
251 ],
252 'center' => [
253 'title' => esc_html__( 'Center', 'ultimate-store-kit' ),
254 'icon' => 'eicon-h-align-center',
255 ],
256 'right' => [
257 'title' => esc_html__( 'Right', 'ultimate-store-kit' ),
258 'icon' => 'eicon-h-align-right',
259 ],
260 ],
261 'prefix_class' => 'elementor%s-align-',
262 'default' => 'left',
263 ]
264 );
265
266 $this->add_control(
267 'mini_cart_icon_indent',
268 [
269 'label' => esc_html__( 'Icon Spacing', 'ultimate-store-kit' ),
270 'type' => Controls_Manager::SLIDER,
271 'default' => [
272 'size' => 8,
273 ],
274 'range' => [
275 'px' => [
276 'max' => 50,
277 ],
278 ],
279 'selectors' => [
280 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner' => 'grid-gap: {{SIZE}}{{UNIT}};',
281 ],
282 'condition' => [
283 'show_cart_icon' => 'yes',
284 'show_price_amount' => 'yes'
285 ]
286 ]
287 );
288
289 $this->end_controls_section();
290 }
291
292 public function render_style_controls_mini_cart() {
293 $this->start_controls_section(
294 'section_style_mini_cart_content',
295 [
296 'label' => esc_html__( 'Mini Cart', 'ultimate-store-kit' ),
297 'tab' => Controls_Manager::TAB_STYLE,
298 ]
299 );
300
301 $this->add_control(
302 'mini_cart_price_amount_color',
303 [
304 'label' => esc_html__( 'Amount Color', 'ultimate-store-kit' ),
305 'type' => Controls_Manager::COLOR,
306 'selectors' => [
307 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-mini-cart-price-amount *' => 'color: {{VALUE}};',
308 ],
309 'condition' => [
310 'show_price_amount' => 'yes'
311 ]
312 ]
313 );
314
315 $this->add_control(
316 'mini_cart_icon_color',
317 [
318 'label' => esc_html__( 'Icon Color', 'ultimate-store-kit' ),
319 'type' => Controls_Manager::COLOR,
320 'selectors' => [
321 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-cart-icon i' => 'color: {{VALUE}};',
322 ],
323 ]
324 );
325
326 $this->add_control(
327 'mini_cart_background_color',
328 [
329 'label' => esc_html__( 'Background Color', 'ultimate-store-kit' ),
330 'type' => Controls_Manager::COLOR,
331 'selectors' => [
332 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner' => 'background: {{VALUE}};',
333 ],
334 ]
335 );
336
337 $this->add_group_control(
338 Group_Control_Border::get_type(),
339 [
340 'name' => 'mini_cart_border',
341 'label' => esc_html__( 'Border', 'ultimate-store-kit' ),
342 'selector' => '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner',
343 ]
344 );
345
346 $this->add_control(
347 'mini_cart_border_radius',
348 [
349 'label' => esc_html__( 'Border Radius', 'ultimate-store-kit' ),
350 'type' => Controls_Manager::DIMENSIONS,
351 'size_units' => [ 'px', '%' ],
352 'selectors' => [
353 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
354 ],
355 ]
356 );
357
358 $this->add_responsive_control(
359 'mini_cart_padding',
360 [
361 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
362 'type' => Controls_Manager::DIMENSIONS,
363 'size_units' => [ 'px', 'em', '%' ],
364 'selectors' => [
365 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
366 ],
367 ]
368 );
369
370 $this->add_group_control(
371 Group_Control_Typography::get_type(),
372 [
373 'name' => 'price_amount_typography',
374 'selector' => '{{WRAPPER}} .usk-mini-cart-inner .woocommerce-Price-amount.amount, {{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-cart-icon i',
375 ]
376 );
377
378 $this->add_control(
379 'mini_cart_badge_style',
380 [
381 'label' => esc_html__( 'Cart Badge', 'ultimate-store-kit' ),
382 'type' => Controls_Manager::HEADING,
383 'separator' => 'before',
384 ]
385 );
386
387 $this->add_control(
388 'mini_cart_badge_color',
389 [
390 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
391 'type' => Controls_Manager::COLOR,
392 'selectors' => [
393 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-cart-badge' => 'color: {{VALUE}};',
394 ],
395 ]
396 );
397
398 $this->add_control(
399 'mini_cart_badge_background_color',
400 [
401 'label' => esc_html__( 'Background', 'ultimate-store-kit' ),
402 'type' => Controls_Manager::COLOR,
403 'selectors' => [
404 '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-cart-badge' => 'background: {{VALUE}};',
405 ],
406 ]
407 );
408 // $this->add_responsive_control(
409 // 'mini_cart_badge_padding',
410 // [
411 // 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
412 // 'type' => Controls_Manager::DIMENSIONS,
413 // 'size_units' => [ 'px', '%', 'em' ],
414 // 'selectors' => [
415 // '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-cart-badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
416 // ],
417 // ]
418 // );
419 $this->add_responsive_control(
420 'mini_cart_badge_size',
421 [
422 'label' => esc_html__( 'Size', 'ultimate-store-kit' ),
423 'type' => Controls_Manager::SLIDER,
424 'size_units' => [ 'px', 'em', 'rem' ],
425 'selectors' => [
426 '{{WRAPPER}} .usk-mini-cart-inner .usk-cart-badge' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
427 ],
428 ]
429 );
430
431 $this->add_group_control(
432 Group_Control_Typography::get_type(),
433 [
434 'name' => 'cart_badge_typography',
435 'selector' => '{{WRAPPER}} .usk-mini-cart-toggle-btn .usk-mini-cart-inner .usk-cart-badge',
436 ]
437 );
438
439 $this->end_controls_section();
440 }
441 protected function render_style_controls_offcanvas() {
442 $this->start_controls_section(
443 'section_style_offcanvas_content',
444 [
445 'label' => esc_html__( 'Offcanvas', 'ultimate-store-kit' ),
446 'tab' => Controls_Manager::TAB_STYLE,
447 ]
448 );
449
450 $this->start_controls_tabs( 'tabs_style_offcanvas_content' );
451
452 $this->start_controls_tab(
453 'tab_style_product_cart',
454 [
455 'label' => esc_html__( 'Product List', 'ultimate-store-kit' ),
456 ]
457 );
458
459 $this->add_control(
460 'product_cart_main_title_color',
461 [
462 'label' => esc_html__( 'Cart Title Color', 'ultimate-store-kit' ),
463 'type' => Controls_Manager::COLOR,
464 'selectors' => [
465 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-widget-title' => 'color: {{VALUE}}',
466 ],
467 ]
468 );
469
470 $this->add_control(
471 'product_cart_main_title_border_color',
472 [
473 'label' => esc_html__( 'Cart Border Color', 'ultimate-store-kit' ),
474 'type' => Controls_Manager::COLOR,
475 'selectors' => [
476 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-widget-title' => 'border-color: {{VALUE}}',
477 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-product-item' => 'border-bottom-color: {{VALUE}}'
478 ],
479 ]
480 );
481
482 $this->add_group_control(
483 Group_Control_Typography::get_type(),
484 [
485 'name' => 'product_cart_main_title_typography',
486 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-widget-title',
487 ]
488 );
489
490 $this->add_control(
491 'product_cart_style',
492 [
493 'label' => esc_html__( 'Product Cart', 'ultimate-store-kit' ),
494 'type' => Controls_Manager::HEADING,
495 'separator' => 'before',
496 ]
497 );
498
499 $this->add_control(
500 'product_cart_title_color',
501 [
502 'label' => esc_html__( 'Title Color', 'ultimate-store-kit' ),
503 'type' => Controls_Manager::COLOR,
504 'selectors' => [
505 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-name a' => 'color: {{VALUE}};',
506 ],
507 ]
508 );
509
510 $this->add_control(
511 'product_cart_title_hover_color',
512 [
513 'label' => esc_html__( 'Title Hover Color', 'ultimate-store-kit' ),
514 'type' => Controls_Manager::COLOR,
515 'selectors' => [
516 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-name a:hover' => 'color: {{VALUE}};',
517 ],
518 ]
519 );
520
521 $this->add_group_control(
522 Group_Control_Typography::get_type(),
523 [
524 'name' => 'product_cart_title_typography',
525 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-name a',
526 ]
527 );
528
529 // $this->add_control(
530 // 'product_cart_item_border_color',
531 // [
532 // 'label' => esc_html__('Item Border Color', 'ultimate-store-kit'),
533 // 'type' => Controls_Manager::COLOR,
534 // 'selectors' => [
535 // '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item' => 'border-color: {{VALUE}};',
536 // ],
537 // 'separator' => 'before',
538 // ]
539 // );
540
541 $this->add_control(
542 'product_cart_quantity_price_style',
543 [
544 'label' => esc_html__( 'Price', 'ultimate-store-kit' ),
545 'type' => Controls_Manager::HEADING,
546 'separator' => 'before',
547 ]
548 );
549
550 $this->add_control(
551 'product_cart_quantity_color',
552 [
553 'label' => esc_html__( 'Quantity Color', 'ultimate-store-kit' ),
554 'type' => Controls_Manager::COLOR,
555 'selectors' => [
556 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-price .quantity' => 'color: {{VALUE}};',
557 ],
558 ]
559 );
560
561 $this->add_control(
562 'product_cart_price_color',
563 [
564 'label' => esc_html__( 'Amount Color', 'ultimate-store-kit' ),
565 'type' => Controls_Manager::COLOR,
566 'selectors' => [
567 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-price .amount' => 'color: {{VALUE}} !important;',
568 ],
569 ]
570 );
571
572 $this->add_group_control(
573 Group_Control_Typography::get_type(),
574 [
575 'name' => 'product_cart_price_typography',
576 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-price',
577 ]
578 );
579
580 $this->add_control(
581 'product_cart_image_style',
582 [
583 'label' => esc_html__( 'Image', 'ultimate-store-kit' ),
584 'type' => Controls_Manager::HEADING,
585 'separator' => 'before',
586 ]
587 );
588
589 $this->add_group_control(
590 Group_Control_Border::get_type(),
591 [
592 'name' => 'product_cart_image_border',
593 'label' => esc_html__( 'Image Border', 'ultimate-store-kit' ),
594 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-thumbnail img',
595 ]
596 );
597
598 $this->add_responsive_control(
599 'product_cart_image_radius',
600 [
601 'label' => esc_html__( 'Image Border Radius', 'ultimate-store-kit' ),
602 'type' => Controls_Manager::DIMENSIONS,
603 'size_units' => [ 'px', '%' ],
604 'selectors' => [
605 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-thumbnail' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
606 ],
607 ]
608 );
609
610 $this->add_control(
611 'product_cart_subtotal_style',
612 [
613 'label' => esc_html__( 'Subtotal', 'ultimate-store-kit' ),
614 'type' => Controls_Manager::HEADING,
615 'separator' => 'before',
616 ]
617 );
618
619 $this->add_control(
620 'product_cart_subtotal_color',
621 [
622 'label' => esc_html__( 'Label Color', 'ultimate-store-kit' ),
623 'type' => Controls_Manager::COLOR,
624 'selectors' => [
625 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-subtotal strong' => 'color: {{VALUE}};',
626 ],
627 ]
628 );
629
630 $this->add_control(
631 'product_cart_subtotal_tax_color',
632 [
633 'label' => esc_html__( 'Price Color', 'ultimate-store-kit' ),
634 'type' => Controls_Manager::COLOR,
635 'selectors' => [
636 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-subtotal .woocommerce-Price-amount.amount' => 'color: {{VALUE}};',
637 ],
638 ]
639 );
640
641 $this->add_group_control(
642 Group_Control_Typography::get_type(),
643 [
644 'name' => 'product_cart_subtotal_typography',
645 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-subtotal *',
646 ]
647 );
648
649 $this->add_control(
650 'product_cart_viewcart_button_style',
651 [
652 'label' => esc_html__( 'View Cart Button', 'ultimate-store-kit' ),
653 'type' => Controls_Manager::HEADING,
654 'separator' => 'before',
655 ]
656 );
657
658 $this->add_control(
659 'pc_viewcart_text_color',
660 [
661 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
662 'type' => Controls_Manager::COLOR,
663 'default' => '',
664 'selectors' => [
665 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons a.bdt-button-view-cart' => 'color: {{VALUE}};',
666 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons a.bdt-button-view-cart .bdt-button-text' => 'color: {{VALUE}};',
667 ],
668 ]
669 );
670
671 $this->add_control(
672 'pc_viewcart_button_hover_color',
673 [
674 'label' => esc_html__( 'Hover Color', 'ultimate-store-kit' ),
675 'type' => Controls_Manager::COLOR,
676 'selectors' => [
677 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons a.bdt-button-view-cart:hover' => 'color: {{VALUE}};',
678 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons a.bdt-button-view-cart:hover .bdt-button-text' => 'color: {{VALUE}};',
679 ],
680 ]
681 );
682
683 $this->add_group_control(
684 Group_Control_Background::get_type(),
685 [
686 'name' => 'pc_viewcart_background_color',
687 'label' => __( 'Background', 'ultimate-store-kit' ),
688 'types' => [ 'classic', 'gradient' ],
689 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-view-cart',
690 'fields_options' => [
691 'background' => [
692 'label' => esc_html__('Background', 'ultimate-store-kit'),
693 ],
694 ],
695 ]
696 );
697
698 $this->add_group_control(
699 Group_Control_Background::get_type(),
700 [
701 'name' => 'pc_viewcart_background_hover_color',
702 'label' => __( 'Background', 'ultimate-store-kit' ),
703 'types' => [ 'classic', 'gradient' ],
704 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-view-cart::before',
705 'fields_options' => [
706 'background' => [
707 'label' => esc_html__('Hover Background', 'ultimate-store-kit'),
708 ],
709 ],
710 ]
711 );
712
713 $this->add_group_control(
714 Group_Control_Border::get_type(),
715 [
716 'name' => 'pc_viewcart_border',
717 'label' => esc_html__( 'Border', 'ultimate-store-kit' ),
718 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-view-cart',
719 ]
720 );
721
722 $this->add_control(
723 'pc_viewcart_hover_border_color',
724 [
725 'label' => esc_html__( 'Hover Border Color', 'ultimate-store-kit' ),
726 'type' => Controls_Manager::COLOR,
727 'condition' => [
728 'pc_viewcart_border_border!' => '',
729 ],
730 'selectors' => [
731 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-view-cart:hover' => 'border-color: {{VALUE}};',
732 ],
733 ]
734 );
735
736 $this->add_control(
737 'pc_viewcart_border_radius',
738 [
739 'label' => esc_html__( 'Border Radius', 'ultimate-store-kit' ),
740 'type' => Controls_Manager::DIMENSIONS,
741 'size_units' => [ 'px', '%' ],
742 'selectors' => [
743 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-view-cart' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
744 ],
745 ]
746 );
747
748 $this->add_control(
749 'pc_viewcart_padding',
750 [
751 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
752 'type' => Controls_Manager::DIMENSIONS,
753 'size_units' => [ 'px', 'em', '%' ],
754 'selectors' => [
755 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-view-cart' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
756 ],
757 ]
758 );
759
760 $this->add_group_control(
761 Group_Control_Box_Shadow::get_type(),
762 [
763 'name' => 'pc_viewcart_shadow',
764 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-view-cart',
765 ]
766 );
767
768 $this->add_group_control(
769 Group_Control_Typography::get_type(),
770 [
771 'name' => 'pc_viewcart_typography',
772 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
773 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-view-cart .bdt-button-text',
774 ]
775 );
776
777 $this->add_control(
778 'product_cart_checkout_button_style',
779 [
780 'label' => esc_html__( 'Checkout Button', 'ultimate-store-kit' ),
781 'type' => Controls_Manager::HEADING,
782 'separator' => 'before',
783 ]
784 );
785
786 $this->add_control(
787 'pc_checkout_text_color',
788 [
789 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
790 'type' => Controls_Manager::COLOR,
791 'default' => '',
792 'selectors' => [
793 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout' => 'color: {{VALUE}};',
794 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout .bdt-button-text' => 'color: {{VALUE}};',
795 ],
796 ]
797 );
798
799 $this->add_control(
800 'pc_checkout_button_hover_color',
801 [
802 'label' => esc_html__( 'Hover Color', 'ultimate-store-kit' ),
803 'type' => Controls_Manager::COLOR,
804 'selectors' => [
805 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout:hover' => 'color: {{VALUE}};',
806 '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout:hover .bdt-button-text' => 'color: {{VALUE}};',
807 ],
808 ]
809 );
810
811 $this->add_group_control(
812 Group_Control_Background::get_type(),
813 [
814 'name' => 'pc_checkout_background_color',
815 'label' => __( 'Background', 'ultimate-store-kit' ),
816 'types' => [ 'classic', 'gradient' ],
817 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout',
818 'fields_options' => [
819 'background' => [
820 'label' => esc_html__('Background', 'ultimate-store-kit'),
821 ],
822 ],
823 ]
824 );
825
826 $this->add_group_control(
827 Group_Control_Background::get_type(),
828 [
829 'name' => 'pc_checkout_background_hover_color',
830 'label' => __( 'Background', 'ultimate-store-kit' ),
831 'types' => [ 'classic', 'gradient' ],
832 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout:hover',
833 'fields_options' => [
834 'background' => [
835 'label' => esc_html__('Hover Background', 'ultimate-store-kit'),
836 ],
837 ],
838 ]
839 );
840
841 $this->add_group_control(
842 Group_Control_Border::get_type(),
843 [
844 'name' => 'pc_checkout_border',
845 'label' => esc_html__( 'Border', 'ultimate-store-kit' ),
846 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-checkout',
847 ]
848 );
849
850 $this->add_control(
851 'pc_checkout_hover_border_color',
852 [
853 'label' => esc_html__( 'Hover Border Color', 'ultimate-store-kit' ),
854 'type' => Controls_Manager::COLOR,
855 'condition' => [
856 'pc_checkout_border_border!' => '',
857 ],
858 'selectors' => [
859 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-checkout:hover' => 'border-color: {{VALUE}};',
860 ],
861 ]
862 );
863
864 $this->add_control(
865 'pc_checkout_border_radius',
866 [
867 'label' => esc_html__( 'Border Radius', 'ultimate-store-kit' ),
868 'type' => Controls_Manager::DIMENSIONS,
869 'size_units' => [ 'px', '%' ],
870 'selectors' => [
871 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-checkout' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
872 ],
873 ]
874 );
875
876 $this->add_control(
877 'pc_checkout_padding',
878 [
879 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
880 'type' => Controls_Manager::DIMENSIONS,
881 'size_units' => [ 'px', 'em', '%' ],
882 'selectors' => [
883 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-checkout' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
884 ],
885 ]
886 );
887
888 $this->add_group_control(
889 Group_Control_Box_Shadow::get_type(),
890 [
891 'name' => 'pc_checkout_shadow',
892 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-checkout',
893 ]
894 );
895
896 $this->add_group_control(
897 Group_Control_Typography::get_type(),
898 [
899 'name' => 'pc_checkout_typography',
900 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
901 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-footer-buttons .bdt-button-checkout, #usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-footer-buttons .bdt-button-checkout .bdt-button-text',
902 ]
903 );
904
905 $this->add_control(
906 'product_cart_remove_button_style',
907 [
908 'label' => esc_html__( 'Product Remove Button', 'ultimate-store-kit' ),
909 'type' => Controls_Manager::HEADING,
910 'separator' => 'before',
911 ]
912 );
913
914 $this->add_control(
915 'pc_remove_text_color',
916 [
917 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
918 'type' => Controls_Manager::COLOR,
919 'default' => '',
920 'selectors' => [
921 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a' => 'color: {{VALUE}};',
922 ],
923 ]
924 );
925
926 $this->add_control(
927 'pc_remove_button_hover_color',
928 [
929 'label' => esc_html__( 'Hover Color', 'ultimate-store-kit' ),
930 'type' => Controls_Manager::COLOR,
931 'selectors' => [
932 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a:hover' => 'color: {{VALUE}};',
933 ],
934 ]
935 );
936
937 $this->add_control(
938 'pc_remove_background_color',
939 [
940 'label' => esc_html__( 'Background Color', 'ultimate-store-kit' ),
941 'type' => Controls_Manager::COLOR,
942 'selectors' => [
943 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a' => 'background-color: {{VALUE}};',
944 ],
945 ]
946 );
947
948 $this->add_control(
949 'pc_remove_background_hover_color',
950 [
951 'label' => esc_html__( 'Hover Background Color', 'ultimate-store-kit' ),
952 'type' => Controls_Manager::COLOR,
953 'selectors' => [
954 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a:hover' => 'background-color: {{VALUE}};',
955 ],
956 ]
957 );
958
959 $this->add_group_control(
960 Group_Control_Border::get_type(),
961 [
962 'name' => 'pc_remove_border',
963 'label' => esc_html__( 'Border', 'ultimate-store-kit' ),
964 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a',
965 ]
966 );
967
968 $this->add_control(
969 'pc_remove_hover_border_color',
970 [
971 'label' => esc_html__( 'Hover Border Color', 'ultimate-store-kit' ),
972 'type' => Controls_Manager::COLOR,
973 'condition' => [
974 'pc_remove_border_border!' => '',
975 ],
976 'selectors' => [
977 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a:hover' => 'border-color: {{VALUE}};',
978 ],
979 ]
980 );
981
982 $this->add_control(
983 'pc_remove_border_radius',
984 [
985 'label' => esc_html__( 'Border Radius', 'ultimate-store-kit' ),
986 'type' => Controls_Manager::DIMENSIONS,
987 'size_units' => [ 'px', '%' ],
988 'selectors' => [
989 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
990 ],
991 ]
992 );
993
994 $this->add_control(
995 'pc_remove_padding',
996 [
997 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
998 'type' => Controls_Manager::DIMENSIONS,
999 'size_units' => [ 'px', 'em', '%' ],
1000 'selectors' => [
1001 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1002 ],
1003 ]
1004 );
1005
1006 $this->add_group_control(
1007 Group_Control_Box_Shadow::get_type(),
1008 [
1009 'name' => 'pc_remove_shadow',
1010 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item .usk-mini-cart-product-remove a',
1011 ]
1012 );
1013
1014 $this->add_control(
1015 'pc_empty_product_notice',
1016 [
1017 'label' => __('Empty Product Message', 'ultimate-store-kit') . BDTUSK_NC,
1018 'type' => Controls_Manager::HEADING,
1019 'separator' => 'before',
1020 ]
1021 );
1022
1023 $this->add_control(
1024 'pc_empty_product_message_color',
1025 [
1026 'label' => esc_html__( 'Color', 'ultimate-store-kit' ),
1027 'type' => Controls_Manager::COLOR,
1028 'default' => '',
1029 'selectors' => [
1030 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .widget_shopping_cart_content .woocommerce-mini-cart__empty-message' => 'color: {{VALUE}};',
1031 ],
1032 ]
1033 );
1034
1035 $this->add_control(
1036 'pc_empty_product_message_padding',
1037 [
1038 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
1039 'type' => Controls_Manager::DIMENSIONS,
1040 'size_units' => [ 'px', 'em', '%' ],
1041 'selectors' => [
1042 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .widget_shopping_cart_content .woocommerce-mini-cart__empty-message' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1043 ],
1044 ]
1045 );
1046
1047 $this->add_control(
1048 'pc_empty_product_message_margin',
1049 [
1050 'label' => esc_html__( 'Margin', 'ultimate-store-kit' ),
1051 'type' => Controls_Manager::DIMENSIONS,
1052 'size_units' => [ 'px', 'em', '%' ],
1053 'selectors' => [
1054 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .widget_shopping_cart_content .woocommerce-mini-cart__empty-message' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1055 ],
1056 ]
1057 );
1058
1059 $this->add_group_control(
1060 Group_Control_Typography::get_type(),
1061 [
1062 'name' => 'pc_empty_product_message_typography',
1063 'label' => esc_html__( 'Typography', 'ultimate-store-kit' ),
1064 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .widget_shopping_cart_content .woocommerce-mini-cart__empty-message',
1065 ]
1066 );
1067
1068 $this->end_controls_tab();
1069
1070 $this->start_controls_tab(
1071 'tab_style_offcanvas_content',
1072 [
1073 'label' => esc_html__( 'Offcanvas', 'ultimate-store-kit' ),
1074 ]
1075 );
1076 $this->add_control(
1077 'heading_offcanvas_content_background',
1078 [
1079 'label' => __( 'Content Background', 'ultimate-store-kit' ),
1080 'type' => Controls_Manager::HEADING,
1081 'separator' => 'before',
1082 ]
1083 );
1084 $this->add_group_control(
1085 Group_Control_Background::get_type(),
1086 [
1087 'name' => 'offcanvas_content_background_color',
1088 'label' => __( 'Background', 'ultimate-store-kit' ),
1089 'types' => [ 'classic', 'gradient' ],
1090 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container',
1091 ]
1092 );
1093
1094 $this->add_responsive_control(
1095 'offcanvas_content_border_radius',
1096 [
1097 'label' => esc_html__( 'Border Radius', 'ultimate-store-kit' ) . BDTUSK_NC,
1098 'type' => Controls_Manager::DIMENSIONS,
1099 'size_units' => [ 'px', '%' ],
1100 'selectors' => [
1101 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1102 ],
1103 ]
1104 );
1105
1106 $this->add_control(
1107 'heading_offcanvas_item_background',
1108 [
1109 'label' => __( 'Item Background', 'ultimate-store-kit' ),
1110 'type' => Controls_Manager::HEADING,
1111 'separator' => 'before',
1112 ]
1113 );
1114
1115 $this->add_group_control(
1116 Group_Control_Background::get_type(),
1117 [
1118 'name' => 'offcanvas_item_background_color',
1119 'label' => __( 'Background', 'ultimate-store-kit' ),
1120 'types' => [ 'classic', 'gradient' ],
1121 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item',
1122 ]
1123 );
1124
1125 $this->add_control(
1126 'heading_offcanvas_item_hover_background',
1127 [
1128 'label' => __( 'Item Hover Background', 'ultimate-store-kit' ),
1129 'type' => Controls_Manager::HEADING,
1130 'separator' => 'before',
1131 ]
1132 );
1133 $this->add_group_control(
1134 Group_Control_Background::get_type(),
1135 [
1136 'name' => 'offcanvas_item_hover_background_color',
1137 'label' => __( 'Background', 'ultimate-store-kit' ),
1138 'types' => [ 'classic', 'gradient' ],
1139 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container .usk-mini-cart-product-item:hover',
1140 ]
1141 );
1142 $this->add_group_control(
1143 Group_Control_Box_Shadow::get_type(),
1144 [
1145 'name' => 'offcanvas_content_shadow',
1146 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container',
1147 'separator' => 'before',
1148 ]
1149 );
1150
1151 $this->add_responsive_control(
1152 'offcanvas_content_padding',
1153 [
1154 'label' => esc_html__( 'Padding', 'ultimate-store-kit' ),
1155 'type' => Controls_Manager::DIMENSIONS,
1156 'size_units' => [ 'px', 'em', '%' ],
1157 'selectors' => [
1158 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1159 ],
1160 'separator' => 'before',
1161 ]
1162 );
1163
1164 $this->add_responsive_control(
1165 'offcanvas_margin',
1166 [
1167 'label' => esc_html__( 'Margin', 'ultimate-store-kit' ),
1168 'type' => Controls_Manager::DIMENSIONS,
1169 'size_units' => [ 'px', 'em', '%' ],
1170 'selectors' => [
1171 '#usk-mini-cart-{{ID}}.usk-mini-cart .ts-content-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1172 ],
1173 'separator' => 'after'
1174 ]
1175 );
1176 $this->add_control(
1177 'offcanvas_heading_footer',
1178 [
1179 'label' => __( 'Footer', 'ultimate-store-kit' ),
1180 'type' => Controls_Manager::HEADING,
1181 'separator' => 'before',
1182 ]
1183 );
1184 $this->add_group_control(
1185 Group_Control_Background::get_type(),
1186 [
1187 'name' => 'footer_backgrouind',
1188 'label' => __( 'Background', 'ultimate-store-kit' ),
1189 'types' => [ 'classic', 'gradient' ],
1190 'selector' => '#usk-mini-cart-{{ID}}.usk-mini-cart .usk-mini-cart-content-footer',
1191 ]
1192 );
1193 $this->end_controls_tab();
1194 $this->end_controls_tabs();
1195
1196 $this->end_controls_section();
1197 }
1198
1199 protected function register_controls() {
1200 $this->render_layout_controls_offcanvas();
1201 $this->render_controls_mini_cart();
1202 $this->render_controls_settings();
1203
1204 //Style
1205 $this->render_style_controls_mini_cart();
1206 $this->render_style_controls_offcanvas();
1207 }
1208
1209 public function render() {
1210
1211 $settings = $this->get_settings_for_display();
1212 $id = 'usk-mini-cart-' . $this->get_id();
1213 $toggleID = 'usk-mini-cart-toggle-' . $this->get_id();
1214 if ( null === WC()->cart ) {
1215 return;
1216 }
1217 $product_count = WC()->cart->get_cart_contents_count();
1218 // $this->add_render_attribute('mini-cart', 'type', 'button');
1219 $this->add_render_attribute( 'mini-cart', 'id', $toggleID );
1220 $this->add_render_attribute( 'mini-cart', [
1221 'class' => [ 'usk-mini-cart-toggle-btn' ],
1222 'data-settings' => [
1223 wp_json_encode( array_filter( [
1224 'toggleButton' => '#' . $toggleID . '',
1225 // 'position' => $settings['cart_position'],
1226 // 'height' => "100%",
1227 // 'width' => "340px",
1228 // 'startOpen' => true,
1229 // 'closeable' => true,
1230 // 'autoclose' => false,
1231 // 'autocloseDelay' => 5000,
1232 // 'clickOutsideToClose' => true,
1233 ] ) )
1234 ]
1235 ], null, true );
1236 $this->add_render_attribute( 'offcanvas', [
1237 'id' => $id,
1238 'class' => [ 'usk-mini-cart toolslide' ],
1239 ], null, true );
1240 ?>
1241 <div class="ultimate-store-kit">
1242 <div <?php $this->print_render_attribute_string( 'mini-cart' ); ?>>
1243 <span class="usk-mini-cart-inner">
1244 <?php if ( $settings['show_price_amount'] === 'yes' ) : ?>
1245 <span class="usk-cart-button-text">
1246 <span class="usk-mini-cart-price-amount">
1247 <?php echo WC()->cart->get_cart_subtotal(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- WooCommerce returns a formatted price as markup. ?>
1248 </span>
1249 </span>
1250 <?php endif; ?>
1251
1252 <?php if ( $settings['show_cart_icon'] === 'yes' ) : ?>
1253 <span class="usk-mini-cart-button-icon">
1254 <?php if ( ( $product_count != 0 ) ) : ?>
1255 <span class="usk-cart-badge">
1256 <?php echo esc_html( $product_count ); ?>
1257 </span>
1258 <?php endif; ?>
1259 <span class="usk-cart-icon">
1260 <i class="usk-icon-cart" aria-hidden="true"></i>
1261 </span>
1262 </span>
1263 <?php endif; ?>
1264 </span>
1265 </div>
1266
1267 <!-- OFFCANVAS -->
1268 <div <?php $this->print_render_attribute_string( 'offcanvas' ); ?>>
1269 <div class="ts-container">
1270 <div class="ts-nav-container"></div>
1271 <div class="ts-content-container">
1272 <div id="first" class="ts-content-item">
1273 <div class="usk-widget-title">
1274 <?php echo wp_kses_post( $settings['custom_widget_cart_title'] ); ?>
1275 </div>
1276 <div class="widget_shopping_cart_content">
1277 <?php
1278 $cart_items = WC()->cart->get_cart();
1279 if ( empty( $cart_items ) ) { ?>
1280 <div class="woocommerce-mini-cart__empty-message">
1281 <?php esc_attr_e( 'No products in the cart.', 'ultimate-store-kit' ); ?>
1282 </div>
1283 <?php } else { ?>
1284 <div class="usk-mini-cart-products woocommerce-mini-cart cart woocommerce-cart-form__contents">
1285 <?php
1286 do_action( 'woocommerce_before_mini_cart_contents' );
1287 foreach ( $cart_items as $cart_item_key => $cart_item ) {
1288 $this->ultimate_store_kit_render_mini_cart_item( $cart_item_key, $cart_item );
1289 }
1290 do_action( 'woocommerce_mini_cart_contents' );
1291 ?>
1292 </div>
1293 <div class="usk-mini-cart-content-footer">
1294 <div class="usk-mini-cart-subtotal bdt-flex bdt-flex-between">
1295 <div>
1296 <strong><?php echo esc_html__( 'Subtotal', 'ultimate-store-kit' ); ?>:</strong>
1297 </div>
1298 <div>
1299 <?php echo WC()->cart->get_cart_subtotal(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- WooCommerce returns a formatted price as markup. ?>
1300 </div>
1301 </div>
1302 <div class="usk-mini-cart-footer-buttons">
1303 <a href="<?php echo esc_url( wc_get_cart_url() ); ?>"
1304 class="bdt-button bdt-button-view-cart bdt-size-md">
1305 <span><?php echo esc_html__( 'View cart', 'ultimate-store-kit' ); ?></span>
1306 </a>
1307 <a href="<?php echo esc_url( wc_get_checkout_url() ); ?>"
1308 class="bdt-button bdt-button-checkout bdt-size-md">
1309 <span><?php echo esc_html__( 'Checkout', 'ultimate-store-kit' ); ?></span>
1310 </a>
1311 </div>
1312 </div>
1313 <?php } ?>
1314 </div>
1315 </div>
1316 </div>
1317 </div>
1318 </div>
1319 </div>
1320 <?php
1321 }
1322
1323
1324
1325 function ultimate_store_kit_render_mini_cart_item( $cart_item_key, $cart_item ) {
1326 $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
1327 $is_product_visible = ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) );
1328
1329 if ( ! $is_product_visible ) {
1330 return;
1331 }
1332
1333 $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
1334 $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
1335 $item_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
1336 ?>
1337 <div
1338 class="usk-mini-cart-product-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
1339
1340 <div class="usk-mini-cart-product-thumbnail">
1341 <?php
1342 $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
1343
1344 if ( ! $item_permalink ) {
1345 echo wp_kses_post( $thumbnail );
1346 } else {
1347 printf( '<a href="%s">%s</a>', esc_url( $item_permalink ), wp_kses_post( $thumbnail ) );
1348 }
1349 ?>
1350 </div>
1351
1352 <div class="usk-mini-cart-content-wrap">
1353 <div class="usk-mini-cart-product-name">
1354 <?php
1355 if ( ! $item_permalink ) {
1356 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;' );
1357 } else {
1358 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $item_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
1359 }
1360
1361 do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
1362
1363 // Meta data.
1364 echo wp_kses_post( wc_get_formatted_cart_item_data( $cart_item ) ); // PHPCS: XSS ok.
1365 ?>
1366 </div>
1367
1368 <div class="usk-mini-cart-product-price" data-title="<?php esc_attr_e( 'Price', 'ultimate-store-kit' ); ?>">
1369 <?php echo wp_kses_post( apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s &times; %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ) ); ?>
1370 </div>
1371 </div>
1372 <div class="usk-mini-cart-product-remove">
1373 <?php
1374 echo wp_kses_post( apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
1375 '<a href="%s" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"><span><i class="usk-icon-close"></i></span></a>',
1376 esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
1377 esc_html__( 'Remove this item', 'ultimate-store-kit' ),
1378 esc_attr( $product_id ),
1379 esc_attr( $cart_item_key ),
1380 esc_attr( $_product->get_sku() )
1381 ), $cart_item_key ) );
1382 ?>
1383 </div>
1384 </div>
1385 <?php
1386 }
1387 }
1388