PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.11.0
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.11.0
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / modules / clear-cart / admin / options.php

options.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.11.0, at inc/modules/clear-cart/admin/options.php

339 lines 10.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Clear Cart
4 *
5 * @package Merchant
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12 /**
13 * Settings
14 */
15 Merchant_Admin_Options::create( array(
16 'title' => esc_html__( 'Settings', 'merchant' ),
17 'module' => Merchant_Clear_Cart::MODULE_ID,
18 'fields' => array(
19 array(
20 'id' => 'cart_threshold',
21 'type' => 'number',
22 'title' => esc_html__( 'Cart Item Threshold', 'merchant' ),
23 'desc' => esc_html__( 'Show a "Clear Cart" button when the cart contains at least this many items.', 'merchant' ),
24 'step' => 1,
25 'default' => 1,
26 ),
27
28 array(
29 'id' => 'enable_auto_clear',
30 'type' => 'switcher',
31 'title' => __( 'Clear Cart After Inactivity', 'merchant' ),
32 'desc' => __( 'Show a prompt to clear the cart when there\'s no user activity for this amount of time.', 'merchant' ),
33 'default' => 0,
34 ),
35
36 array(
37 'id' => 'auto_clear_expiration_hours',
38 'type' => 'number',
39 'title' => esc_html__( 'Time of Cart Session Expiration', 'merchant' ),
40 'desc' => esc_html__( 'After this number of hours with no activity, the user will be prompted to clear their cart.', 'merchant' ),
41 'step' => 1,
42 'condition' => array( 'enable_auto_clear', '==', '1' ),
43 'default' => 24,
44 ),
45
46 array(
47 'id' => 'popup_message',
48 'type' => 'text',
49 'title' => esc_html__( 'Confirmation Message', 'merchant' ),
50 'desc' => esc_html__( 'Clear cart confirmation dialog box', 'merchant' ),
51 'default' => esc_html__( 'Are you sure you want to empty your shopping cart?', 'merchant' ),
52 'conditions' => array(
53 'terms' => array(
54 array(
55 'field' => 'enable_auto_clear',
56 'operator' => '===',
57 'value' => false,
58 ),
59 ),
60 ),
61 ),
62
63 array(
64 'id' => 'popup_message_inactive',
65 'type' => 'text',
66 'title' => esc_html__( 'Inactive Confirmation Message', 'merchant' ),
67 'desc' => esc_html__( 'Clear cart confirmation dialog box', 'merchant' ),
68 'default' => esc_html__( 'It looks like you haven’t been active for a while. Would you like to empty your shopping cart?', 'merchant' ),
69 'condition' => array( 'enable_auto_clear', '==', '1' ),
70 ),
71
72 array(
73 'id' => 'redirect_link',
74 'type' => 'radio',
75 'title' => esc_html__( 'Redirect URL after Clearing the Cart', 'merchant' ),
76 'options' => array(
77 '' => esc_html__( 'None', 'merchant' ),
78 'home' => esc_html__( 'Home', 'merchant' ),
79 'shop' => esc_html__( 'Shop', 'merchant' ),
80 'custom' => esc_html__( 'Custom', 'merchant' ),
81 ),
82 'default' => '',
83 ),
84
85 array(
86 'id' => 'redirect_link_custom',
87 'type' => 'text',
88 'title' => esc_html__( 'Custom Redirect URL', 'merchant' ),
89 'desc' => esc_html__( 'Enter a custom URL to redirect users to a specific page.', 'merchant' ),
90 'placeholder' => esc_attr( 'https://yourdomain.com/page-slug' ),
91 'default' => '',
92 'condition' => array( 'redirect_link', '==', 'custom' ),
93 ),
94 ),
95 ) );
96
97 /**
98 * Placement
99 */
100 Merchant_Admin_Options::create( array(
101 'title' => esc_html__( 'Placement', 'merchant' ),
102 'module' => Merchant_Clear_Cart::MODULE_ID,
103 'fields' => array(
104 array(
105 'id' => 'enable_cart_page',
106 'type' => 'switcher',
107 'title' => __( 'Cart Page', 'merchant' ),
108 'default' => 1,
109 ),
110
111 array(
112 'id' => 'cart_page_position',
113 'type' => 'select',
114 'title' => esc_html__( 'Position', 'merchant' ),
115 'options' => array(
116 'woocommerce_cart_coupon' => esc_html__( 'After Coupon Button', 'merchant' ),
117 'woocommerce_cart_actions' => esc_html__( 'After Update Cart Button', 'merchant' ),
118 'woocommerce_after_cart_table' => esc_html__( 'After Cart Table', 'merchant' ),
119 ),
120 'condition' => array( 'enable_cart_page', '==', '1' ),
121 'default' => 'woocommerce_cart_coupon',
122 ),
123
124 array(
125 'id' => 'enable_mini_cart',
126 'type' => 'switcher',
127 'title' => __( 'Mini Cart', 'merchant' ),
128 'default' => 0,
129 ),
130
131 array(
132 'id' => 'mini_cart_position',
133 'type' => 'select',
134 'title' => esc_html__( 'Position', 'merchant' ),
135 'options' => array(
136 'before_view_cart' => esc_html__( 'Before View Cart Button', 'merchant' ),
137 'after_view_cart' => esc_html__( 'After View Cart Button', 'merchant' ),
138 'after_checkout' => esc_html__( 'After Checkout Button', 'merchant' ),
139 ),
140 'default' => 'after_checkout',
141 'condition' => array( 'enable_mini_cart', '==', '1' ),
142 ),
143
144 array(
145 'id' => 'enable_side_cart',
146 'type' => 'switcher',
147 'title' => esc_html__( 'Side Cart', 'merchant' ),
148 'pro' => true,
149 'default' => 0,
150 ),
151
152 array(
153 'id' => 'side_cart_position',
154 'type' => 'select',
155 'pro' => true,
156 'title' => esc_html__( 'Position', 'merchant' ),
157 'options' => array(
158 'before_view_cart' => esc_html__( 'Before View Cart Button', 'merchant' ),
159 'after_view_cart' => esc_html__( 'After View Cart Button', 'merchant' ),
160 'before_checkout' => esc_html__( 'Before Checkout Button', 'merchant' ),
161 ),
162 'default' => 'after_view_cart',
163 'condition' => array( 'enable_side_cart', '==', '1' ),
164 ),
165
166 array(
167 'id' => 'side_cart_info',
168 'pro' => true,
169 'type' => 'info_block',
170 'description' => esc_html__( 'To add a Clear Cart button to the Side Cart, you need to activate the Side Cart module.', 'merchant' ),
171 'button_text' => esc_html__( 'View Side Cart', 'merchant' ),
172 'button_link' => esc_url( admin_url( 'admin.php?page=merchant&module=side-cart' ) ),
173 'condition' => array( 'enable_side_cart', '==', '1' ),
174 ),
175 ),
176 ) );
177
178 /**
179 * Style
180 */
181 Merchant_Admin_Options::create( array(
182 'title' => esc_html__( 'Look and Feel', 'merchant' ),
183 'module' => Merchant_Clear_Cart::MODULE_ID,
184 'fields' => array(
185 array(
186 'id' => 'label',
187 'type' => 'text',
188 'title' => esc_html__( 'Label', 'merchant' ),
189 'default' => esc_html__( 'Clear Cart', 'merchant' ),
190 ),
191
192 array(
193 'id' => 'style',
194 'type' => 'radio',
195 'title' => esc_html__( 'Style', 'merchant' ),
196 'options' => array(
197 'solid' => esc_html__( 'Solid', 'merchant' ),
198 'outline' => esc_html__( 'Outline', 'merchant' ),
199 'text' => esc_html__( 'Text', 'merchant' ),
200 ),
201 'default' => 'solid',
202 ),
203
204 array(
205 'id' => 'border_width',
206 'type' => 'range',
207 'title' => esc_html__( 'Outline', 'merchant' ),
208 'min' => 1,
209 'max' => 20,
210 'step' => 1,
211 'unit' => 'px',
212 'default' => 2,
213 'condition' => array( 'style', '==', 'outline' ),
214 ),
215
216 array(
217 'id' => 'border_radius',
218 'type' => 'range',
219 'title' => esc_html__( 'Border Radius', 'merchant' ),
220 'min' => 0,
221 'max' => 999,
222 'step' => 1,
223 'unit' => 'px',
224 'default' => 0,
225 'condition' => array( 'style', 'any', 'solid|outline' ),
226 ),
227
228 array(
229 'id' => 'padding_vertical',
230 'type' => 'range',
231 'title' => esc_html__( 'Padding Top/Bottom', 'merchant' ),
232 'min' => 0,
233 'max' => 100,
234 'step' => 1,
235 'default' => 15,
236 'unit' => 'px',
237 'condition' => array( 'style', 'any', 'solid|outline' ),
238 ),
239
240 array(
241 'id' => 'padding_horizontal',
242 'type' => 'range',
243 'title' => esc_html__( 'Padding Left/Right', 'merchant' ),
244 'min' => 0,
245 'max' => 100,
246 'step' => 1,
247 'default' => 25,
248 'unit' => 'px',
249 'condition' => array( 'style', 'any', 'solid|outline' ),
250 ),
251
252 array(
253 'id' => 'background_color',
254 'type' => 'color',
255 'title' => esc_html__( 'Button Background Color', 'merchant' ),
256 'default' => '#212121',
257 'condition' => array( 'style', '==', 'solid' ),
258 ),
259
260 array(
261 'id' => 'background_color_hover',
262 'type' => 'color',
263 'title' => esc_html__( 'Button Background Hover Color', 'merchant' ),
264 'default' => '#414141',
265 'condition' => array( 'style', '==', 'solid' ),
266 ),
267
268 array(
269 'id' => 'text_color',
270 'type' => 'color',
271 'title' => esc_html__( 'Button Text Color', 'merchant' ),
272 'default' => '#ffffff',
273 ),
274
275 array(
276 'id' => 'text_color_hover',
277 'type' => 'color',
278 'title' => esc_html__( 'Button Text Hover Color', 'merchant' ),
279 'default' => '#ffffff',
280 ),
281
282 array(
283 'id' => 'border_color',
284 'type' => 'color',
285 'title' => esc_html__( 'Button Outline Color', 'merchant' ),
286 'default' => '#212121',
287 'condition' => array( 'style', '==', 'outline' ),
288 ),
289
290 array(
291 'id' => 'border_color_hover',
292 'type' => 'color',
293 'title' => esc_html__( 'Button Outline Hover Color', 'merchant' ),
294 'default' => '#414141',
295 'condition' => array( 'style', '==', 'outline' ),
296 ),
297
298 array(
299 'id' => 'font_size',
300 'type' => 'range',
301 'title' => esc_html__( 'Font size', 'merchant' ),
302 'min' => 1,
303 'max' => 100,
304 'step' => 1,
305 'default' => 16,
306 'unit' => 'px',
307 ),
308 ),
309 ) );
310
311 // Shortcode
312 $merchant_module_id = Merchant_Clear_Cart::MODULE_ID;
313 Merchant_Admin_Options::create( array(
314 'module' => $merchant_module_id,
315 'title' => esc_html__( 'Use shortcode', 'merchant' ),
316 'fields' => array(
317 array(
318 'id' => 'use_shortcode',
319 'type' => 'switcher',
320 'title' => __( 'Use shortcode', 'merchant' ),
321 'default' => 0,
322 ),
323
324 array(
325 'type' => 'info',
326 'id' => 'shortcode_info',
327 'content' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings.', 'merchant' ),
328 ),
329
330 array(
331 'id' => 'shortcode_text',
332 'type' => 'text_readonly',
333 'title' => esc_html__( 'Shortcode text', 'merchant' ),
334 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']',
335 'condition' => array( 'use_shortcode', '==', '1' ),
336 ),
337 ),
338 ) );
339