PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.3.1
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.3.1
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / elementor / modules / product-quantity / widgets / product-quantity.php

product-quantity.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.3.1, at includes/elementor/modules/product-quantity/widgets/product-quantity.php

166 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Elementor\Core\Base\Document;
4 use Elementor\Plugin;
5
6 defined( 'ABSPATH' ) || die();
7
8 class Sellkit_Elementor_Product_Quantity_Widget extends Sellkit_Elementor_Upsell_Base_Widget {
9
10 public static function is_active() {
11 return class_exists( 'woocommerce' );
12 }
13
14 public function get_name() {
15 return 'sellkit-product-quantity';
16 }
17
18 public function get_title() {
19 return __( 'Product Quantity', 'sellkit' );
20 }
21
22 public function get_icon() {
23 return 'sellkit-element-icon sellkit-quantity-selector-icon';
24 }
25
26 protected function register_controls() {
27 $this->start_controls_section(
28 'style_tab',
29 [
30 'label' => __( 'Style', 'sellkit' ),
31 'tab' => 'style',
32 ]
33 );
34
35 $this->add_responsive_control(
36 'align',
37 [
38 'label' => __( 'Alignment', 'sellkit' ),
39 'type' => 'choose',
40 'options' => [
41 'flex-start' => [
42 'title' => __( 'Left', 'sellkit' ),
43 'icon' => 'fa fa-align-left',
44 ],
45 'center' => [
46 'title' => __( 'Center', 'sellkit' ),
47 'icon' => 'fa fa-align-center',
48 ],
49 'flex-end' => [
50 'title' => __( 'Right', 'sellkit' ),
51 'icon' => 'fa fa-align-right',
52 ],
53 ],
54 'default' => 'start',
55 'selectors' => [
56 '{{WRAPPER}} .sellkit-product-quantity-widget' => 'justify-content: {{VALUE}}',
57 ],
58 ]
59 );
60
61 $this->add_responsive_control(
62 'quantity_selector_width',
63 [
64 'label' => __( 'Width', 'sellkit' ),
65 'type' => 'slider',
66 'size_units' => [ 'px', '%' ],
67 'range' => [
68 'px' => [
69 'min' => 0,
70 'max' => 500,
71 ],
72 '%' => [
73 'min' => 0,
74 'max' => 100,
75 ],
76 ],
77 'default' => [
78 'unit' => '%',
79 ],
80 'tablet_default' => [
81 'unit' => '%',
82 ],
83 'mobile_default' => [
84 'unit' => '%',
85 ],
86 'selectors' => [
87 '{{WRAPPER}} .sellkit-product-quantity-widget .quantity' => 'width: {{SIZE}}{{UNIT}};',
88 ],
89 ]
90 );
91
92 $this->add_control(
93 'label_color',
94 [
95 'label' => __( 'Label Color', 'sellkit' ),
96 'type' => 'color',
97 'selectors' => [
98 '{{WRAPPER}} .sellkit-product-quantity-widget label' => 'color: {{SIZE}};',
99 ],
100 ]
101 );
102
103 $this->add_control(
104 'input_text_color',
105 [
106 'label' => __( 'Input Text Color', 'sellkit' ),
107 'type' => 'color',
108 'selectors' => [
109 '{{WRAPPER}} .sellkit-product-quantity-widget input' => 'color: {{SIZE}};',
110 ],
111 ]
112 );
113
114 $this->add_group_control(
115 'typography',
116 [
117 'name' => 'input_typography',
118 'scheme' => '3',
119 'selector' => '{{WRAPPER}} .sellkit-product-quantity-widget .quantity input, {{WRAPPER}} .sellkit-product-quantity-widget .quantity .screen-reader-text',
120 ]
121 );
122
123 $this->add_group_control(
124 'text-shadow',
125 [
126 'name' => 'text_shadow',
127 'fields_options' => [
128 'text_shadow_type' => [
129 'label' => __( 'Text Shadow', 'sellkit' ),
130 ],
131 ],
132 'selector' => '{{WRAPPER}} .sellkit-product-quantity-widget .quantity input, {{WRAPPER}} .sellkit-product-quantity-widget .quantity label',
133 ]
134 );
135
136 $this->end_controls_section();
137 }
138
139 protected function render() {
140 global $product;
141
142 $product = $this->get_product_object();
143
144 if ( empty( $product ) ) {
145 return;
146 }
147
148 ?>
149 <div class="sellkit-product-quantity-widget">
150 <?php
151 // phpcs:disable
152 woocommerce_quantity_input(
153 [
154 'product_name' => '',
155 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
156 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
157 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(),
158 ]
159 );
160 // phpcs:enable
161 ?>
162 </div>
163 <?php
164 }
165 }
166