PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.2
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.2
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
← All changes | inc/modules/side-cart/admin/options.php +803 -162 1.72.3.2 View file →
@@ -1,162 +1,803 @@
1 -<?php
2 -
3 -/**
4 - * Side Cart Options.
5 - *
6 - * @package Merchant
7 - */
8 -
9 -if ( ! defined( 'ABSPATH' ) ) {
10 - exit; // Exit if accessed directly
11 -}
12 -
13 -Merchant_Admin_Options::create( array(
14 - 'module' => Merchant_Side_Cart::MODULE_ID,
15 - 'title' => esc_html__( 'Settings', 'merchant' ),
16 - 'fields' => array(
17 - array(
18 - 'id' => 'show_after_add_to_cart',
19 - 'type' => 'switcher',
20 - 'title' => __( 'Display after adding a product to the cart on shop', 'merchant' ),
21 - 'default' => 1
22 - ),
23 - array(
24 - 'id' => 'show_after_add_to_cart_single_product',
25 - 'type' => 'switcher',
26 - 'title' => __( 'Display after adding a product to the cart on single product page', 'merchant' ),
27 - 'default' => 0
28 - ),
29 - array(
30 - 'id' => 'show_on_cart_url_click',
31 - 'type' => 'switcher',
32 - 'title' => __( 'Display on cart URL click', 'merchant' ),
33 - 'default' => 1
34 - ),
35 - ),
36 -) );
37 -
38 -
39 -// Side Cart Settings
40 -Merchant_Admin_Options::create( array(
41 - 'title' => esc_html__( 'Side Cart Settings', 'merchant' ),
42 - 'module' => 'floating-mini-cart',
43 - 'fields' => array(
44 -
45 - array(
46 - 'id' => 'side-cart-width',
47 - 'type' => 'range',
48 - 'title' => esc_html__( 'Side cart width', 'merchant' ),
49 - 'min' => 0,
50 - 'max' => 2000,
51 - 'step' => 1,
52 - 'default' => 380,
53 - 'unit' => 'px',
54 - ),
55 -
56 - array(
57 - 'id' => 'side-cart-title-color',
58 - 'type' => 'color',
59 - 'title' => esc_html__( 'Title color', 'merchant' ),
60 - 'default' => '#212121',
61 - ),
62 -
63 - array(
64 - 'id' => 'side-cart-title-icon-color',
65 - 'type' => 'color',
66 - 'title' => esc_html__( 'Title icon color', 'merchant' ),
67 - 'default' => '#212121',
68 - ),
69 -
70 - array(
71 - 'id' => 'side-cart-title-background-color',
72 - 'type' => 'color',
73 - 'title' => esc_html__( 'Title background color', 'merchant' ),
74 - 'default' => '#cccccc',
75 - ),
76 -
77 - array(
78 - 'id' => 'side-cart-content-text-color',
79 - 'type' => 'color',
80 - 'title' => esc_html__( 'Content text color', 'merchant' ),
81 - 'default' => '#212121',
82 - ),
83 -
84 - array(
85 - 'id' => 'side-cart-content-background-color',
86 - 'type' => 'color',
87 - 'title' => esc_html__( 'Content background color', 'merchant' ),
88 - 'default' => '#ffffff',
89 - ),
90 -
91 - array(
92 - 'id' => 'side-cart-content-remove-color',
93 - 'type' => 'color',
94 - 'title' => esc_html__( 'Content (x) color', 'merchant' ),
95 - 'default' => '#ffffff',
96 - ),
97 -
98 - array(
99 - 'id' => 'side-cart-content-remove-background-color',
100 - 'type' => 'color',
101 - 'title' => esc_html__( 'Content (x) background color', 'merchant' ),
102 - 'default' => '#212121',
103 - ),
104 -
105 - array(
106 - 'id' => 'side-cart-total-text-color',
107 - 'type' => 'color',
108 - 'title' => esc_html__( 'Total text color', 'merchant' ),
109 - 'default' => '#212121',
110 - ),
111 -
112 - array(
113 - 'id' => 'side-cart-total-background-color',
114 - 'type' => 'color',
115 - 'title' => esc_html__( 'Total background color', 'merchant' ),
116 - 'default' => '#f5f5f5',
117 - ),
118 -
119 - array(
120 - 'id' => 'side-cart-button-color',
121 - 'type' => 'color',
122 - 'title' => esc_html__( 'Button color', 'merchant' ),
123 - 'default' => '#ffffff',
124 - ),
125 -
126 - array(
127 - 'id' => 'side-cart-button-color-hover',
128 - 'type' => 'color',
129 - 'title' => esc_html__( 'Button color hover', 'merchant' ),
130 - 'default' => '#ffffff',
131 - ),
132 -
133 - array(
134 - 'id' => 'side-cart-button-border-color',
135 - 'type' => 'color',
136 - 'title' => esc_html__( 'Button border color', 'merchant' ),
137 - 'default' => '#212121',
138 - ),
139 -
140 - array(
141 - 'id' => 'side-cart-button-border-color-hover',
142 - 'type' => 'color',
143 - 'title' => esc_html__( 'Button border color hover', 'merchant' ),
144 - 'default' => '#313131',
145 - ),
146 -
147 - array(
148 - 'id' => 'side-cart-button-background-color',
149 - 'type' => 'color',
150 - 'title' => esc_html__( 'Button background color', 'merchant' ),
151 - 'default' => '#212121',
152 - ),
153 -
154 - array(
155 - 'id' => 'side-cart-button-background-color-hover',
156 - 'type' => 'color',
157 - 'title' => esc_html__( 'Button background color hover', 'merchant' ),
158 - 'default' => '#313131',
159 - ),
160 -
161 - )
162 -) );
1 +<?php
2 +
3 +/**
4 + * Side Cart — Option group definitions.
5 + *
6 + * Pure data file. Returns the option groups array
7 + * consumed by init_option_groups().
8 + *
9 + * @package Merchant
10 + */
11 +
12 +if ( ! defined( 'ABSPATH' ) ) {
13 + exit; // Exit if accessed directly
14 +}
15 +
16 +return array(
17 + array(
18 + 'module' => Merchant_Side_Cart::MODULE_ID,
19 + 'title' => esc_html__( 'Display Settings', 'merchant' ),
20 + 'fields' => array(
21 + array(
22 + 'id' => 'show_after_add_to_cart',
23 + 'type' => 'switcher',
24 + 'title' => esc_html__( 'Shop Page', 'merchant' ),
25 + 'desc' => esc_html__( 'Show side cart after adding product to the cart from shop archive page', 'merchant' ),
26 + 'default' => 1,
27 + ),
28 + array(
29 + 'id' => 'show_after_add_to_cart_single_product',
30 + 'type' => 'switcher',
31 + 'title' => esc_html__( 'Product Page', 'merchant' ),
32 + 'desc' => esc_html__( 'Display side cart after adding product to the cart from product single page', 'merchant' ),
33 + 'default' => 0,
34 + ),
35 + array(
36 + 'id' => 'show_on_cart_url_click',
37 + 'type' => 'switcher',
38 + 'title' => esc_html__( 'Cart Icons', 'merchant' ),
39 + 'desc' => esc_html__( 'Show side cart when a user clicks on the cart URL or menu items', 'merchant' ),
40 + 'default' => 1,
41 + ),
42 + array(
43 + 'id' => 'slide_direction',
44 + 'type' => 'radio',
45 + 'title' => esc_html__( 'Cart position', 'merchant' ),
46 + 'options' => array(
47 + 'right' => esc_html__( 'Slide from right', 'merchant' ),
48 + 'left' => esc_html__( 'Slide from left', 'merchant' ),
49 + ),
50 + 'default' => 'right',
51 + ),
52 + array(
53 + 'id' => 'use_discount_codes',
54 + 'type' => 'switcher',
55 + 'title' => esc_html__( 'Show discount codes input', 'merchant' ),
56 + 'default' => 0,
57 + ),
58 + array(
59 + 'id' => 'show_checkout_btn',
60 + 'type' => 'switcher',
61 + 'title' => esc_html__( 'Show checkout button', 'merchant' ),
62 + 'default' => 1,
63 + ),
64 + array(
65 + 'id' => 'checkout_btn_text',
66 + 'type' => 'text',
67 + // 'title' => esc_html__( 'Placement', 'merchant' ),
68 + 'default' => esc_html__( 'Checkout', 'merchant' ),
69 + 'conditions' => array(
70 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
71 + 'terms' => array(
72 + array(
73 + 'field' => 'show_checkout_btn', // field ID
74 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
75 + 'value' => true, // can be a single value or an array of string/number/int
76 + ),
77 + ),
78 + ),
79 + ),
80 + array(
81 + 'id' => 'show_view_cart_btn',
82 + 'type' => 'switcher',
83 + 'title' => esc_html__( 'Show view cart button', 'merchant' ),
84 + 'default' => 1,
85 + ),
86 + array(
87 + 'id' => 'view_cart_btn_text',
88 + 'type' => 'text',
89 + // 'title' => esc_html__( 'Placement', 'merchant' ),
90 + 'default' => esc_html__( 'View Cart', 'merchant' ),
91 + 'conditions' => array(
92 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
93 + 'terms' => array(
94 + array(
95 + 'field' => 'show_view_cart_btn', // field ID
96 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
97 + 'value' => true, // can be a single value or an array of string/number/int
98 + ),
99 + ),
100 + ),
101 + ),
102 + array(
103 + 'id' => 'use_strikethrough_prices',
104 + 'type' => 'switcher',
105 + 'title' => esc_html__( 'Show strikethrough prices', 'merchant' ),
106 + 'default' => 1,
107 + ),
108 + array(
109 + 'id' => 'show_savings',
110 + 'type' => 'switcher',
111 + 'title' => esc_html__( 'Show cart savings', 'merchant' ),
112 + 'default' => 0,
113 + ),
114 + array(
115 + 'id' => 'show_on_devices',
116 + 'type' => 'checkbox_multiple',
117 + 'title' => esc_html__( 'Show on devices', 'merchant' ),
118 + 'options' => array(
119 + 'desktop' => esc_html__( 'Desktop', 'merchant' ),
120 + 'mobile' => esc_html__( 'Mobile', 'merchant' ),
121 + ),
122 + 'default' => array( 'desktop', 'mobile' ),
123 + ),
124 + ),
125 +),
126 + array(
127 + 'module' => Merchant_Side_Cart::MODULE_ID,
128 + 'title' => esc_html__( 'Upsells', 'merchant' ),
129 + 'fields' => array(
130 + array(
131 + 'id' => 'use_upsells',
132 + 'type' => 'switcher',
133 + 'title' => esc_html__( 'Cart Upsells', 'merchant' ),
134 + 'desc' => esc_html__( 'Enable upsell products in the side cart', 'merchant' ),
135 + 'default' => 0,
136 + ),
137 + array(
138 + 'id' => 'upsells_type',
139 + 'type' => 'select',
140 + //'title' => esc_html__( 'Placement', 'merchant' ),
141 + 'options' => array(
142 + 'related_products' => esc_html__( 'Related Products', 'merchant' ),
143 + 'custom_upsell' => esc_html__( 'Custom Upsells', 'merchant' ),
144 + ),
145 + 'default' => 'related_products',
146 + 'conditions' => array(
147 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
148 + 'terms' => array(
149 + array(
150 + 'field' => 'use_upsells', // field ID
151 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
152 + 'value' => true, // can be a single value or an array of string/number/int
153 + ),
154 + ),
155 + ),
156 + ),
157 +
158 + array(
159 + 'id' => 'custom_upsells',
160 + 'type' => 'flexible_content',
161 + 'sorting' => true,
162 + 'accordion' => true,
163 + 'duplicate' => false,
164 + 'style' => Merchant_Side_Cart::MODULE_ID . '-style default',
165 + 'button_label' => esc_html__( 'Add New Upsell', 'merchant' ),
166 + 'conditions' => array(
167 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
168 + 'terms' => array(
169 + array(
170 + 'field' => 'use_upsells', // field ID
171 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
172 + 'value' => true, // can be a single value or an array of string/number/int
173 + ),
174 + array(
175 + 'field' => 'upsells_type', // field ID
176 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
177 + 'value' => 'custom_upsell', // can be a single value or an array of string/number/int
178 + ),
179 + ),
180 + ),
181 + 'default' => array(
182 + array(
183 + 'layout' => 'upsell-details',
184 + 'upsell_based_on' => 'products',
185 + 'exclude_product_ids' => 0,
186 + 'custom_upsell_type' => 'products',
187 + ),
188 + ),
189 + 'layouts' => array(
190 + 'upsell-details' => array(
191 + 'title' => esc_html__( 'Custom Upsells', 'merchant' ),
192 + 'title-field' => 'offer-title', // text field ID to use as title for the layout
193 + 'fields' => array(
194 + array(
195 + 'id' => 'upsell_based_on',
196 + 'type' => 'select',
197 + 'title' => esc_html__( 'Trigger to add the upsell for', 'merchant' ),
198 + 'options' => array(
199 + 'all' => esc_html__( 'All products', 'merchant' ),
200 + 'products' => esc_html__( 'Specific product', 'merchant' ),
201 + 'categories' => esc_html__( 'Specific category', 'merchant' ),
202 + ),
203 + 'default' => 'products',
204 + 'ai_meta' => array(
205 + 'semantic_group' => 'product_targeting',
206 + 'usage_hint' => 'Controls which cart products trigger this upsell. Set this BEFORE setting product_ids or category_slugs — those fields are conditional on this value.',
207 + ),
208 + ),
209 + array(
210 + 'id' => 'product_ids',
211 + 'type' => 'products_selector',
212 + 'title' => esc_html__( 'Select product(s)', 'merchant' ),
213 + 'multiple' => true,
214 + 'desc' => esc_html__( 'Select the product(s) that you want to add the upsell for', 'merchant' ),
215 + 'allowed_types' => array( 'simple', 'variable' ),
216 + 'conditions' => array(
217 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
218 + 'terms' => array(
219 + array(
220 + 'field' => 'upsell_based_on', // field ID
221 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
222 + 'value' => 'products', // can be a single value or an array of string/number/int
223 + ),
224 + ),
225 + ),
226 + 'ai_meta' => array(
227 + 'entity' => 'product',
228 + 'reference_type' => 'static',
229 + 'value_format' => 'product_id',
230 + 'semantic_group' => 'product_targeting',
231 + 'abstraction_level' => 1,
232 + 'usage_hint' => 'Use when triggering the upsell for specific individual products in the cart. Requires upsell_based_on=products.',
233 + ),
234 + ),
235 + array(
236 + 'id' => 'category_slugs',
237 + 'type' => 'select_ajax',
238 + 'title' => esc_html__( 'Select categories', 'merchant' ),
239 + 'source' => 'options',
240 + 'multiple' => true,
241 + 'options' => Merchant_Admin_Options::get_category_select2_choices(),
242 + 'placeholder' => esc_html__( 'Search categories', 'merchant' ),
243 + 'desc' => esc_html__( 'Select the categories that you want to add the upsell for.', 'merchant' ),
244 + 'conditions' => array(
245 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
246 + 'terms' => array(
247 + array(
248 + 'field' => 'upsell_based_on', // field ID
249 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
250 + 'value' => 'categories', // can be a single value or an array of string/number/int
251 + ),
252 + ),
253 + ),
254 + 'ai_meta' => array(
255 + 'entity' => 'category',
256 + 'reference_type' => 'dynamic',
257 + 'taxonomy' => 'product_cat',
258 + 'value_format' => 'slug',
259 + 'semantic_group' => 'product_targeting',
260 + 'abstraction_level' => 3,
261 + 'usage_hint' => 'Use when triggering the upsell for products from specific categories in the cart. Dynamic: future products in the category are included. Requires upsell_based_on=categories.',
262 + ),
263 + ),
264 + array(
265 + 'id' => 'exclusion_toggle',
266 + 'type' => 'switcher',
267 + 'title' => esc_html__( 'Exclusion List', 'merchant' ),
268 + 'desc' => esc_html__( 'Select products that will not display upsells.', 'merchant' ),
269 + 'default' => 0,
270 + 'conditions' => array(
271 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
272 + 'terms' => array(
273 + array(
274 + 'field' => 'upsell_based_on', // field ID
275 + 'operator' => 'in', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
276 + 'value' => array( 'all', 'categories' ), // can be a single value or an array of string/number/int
277 + ),
278 + ),
279 + ),
280 + 'ai_meta' => array(
281 + 'toggle_for' => 'excluded_product_ids',
282 + 'semantic_group' => 'product_exclusion',
283 + 'usage_hint' => 'Enable this toggle before setting excluded_product_ids or excluded_category_slugs. Only available when upsell_based_on is all or categories.',
284 + ),
285 + ),
286 + array(
287 + 'id' => 'excluded_product_ids',
288 + 'type' => 'products_selector',
289 + 'title' => esc_html__( 'Exclude products', 'merchant' ),
290 + 'multiple' => true,
291 + 'desc' => esc_html__( 'Upsell will not be displayed for selected products.', 'merchant' ),
292 + 'allowed_types' => array( 'simple', 'variable' ),
293 + 'conditions' => array(
294 + 'relation' => 'OR', // AND/OR, If not provided, only first term will be considered
295 + 'terms' => array(
296 + array(
297 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
298 + 'terms' => array(
299 + array(
300 + 'field' => 'upsell_based_on', // field ID
301 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
302 + 'value' => 'all', // can be a single value or an array of string/number/int
303 + ),
304 + array(
305 + 'field' => 'exclusion_toggle', // field ID
306 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
307 + 'value' => true, // can be a single value or an array of string/number/int
308 + ),
309 + ),
310 + ),
311 + array(
312 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
313 + 'terms' => array(
314 + array(
315 + 'field' => 'upsell_based_on', // field ID
316 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
317 + 'value' => 'categories', // can be a single value or an array of string/number/int
318 + ),
319 + array(
320 + 'field' => 'exclusion_toggle', // field ID
321 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
322 + 'value' => true, // can be a single value or an array of string/number/int
323 + ),
324 + ),
325 + ),
326 + ),
327 + ),
328 + 'ai_meta' => array(
329 + 'entity' => 'product',
330 + 'reference_type' => 'static',
331 + 'value_format' => 'product_id',
332 + 'semantic_group' => 'product_exclusion',
333 + 'abstraction_level' => 1,
334 + 'toggled_by' => 'exclusion_toggle',
335 + 'usage_hint' => 'Products in the cart that will NOT show this upsell. Requires exclusion_toggle=true.',
336 + ),
337 + ),
338 + array(
339 + 'id' => 'excluded_category_slugs',
340 + 'type' => 'select_ajax',
341 + 'title' => esc_html__( 'Exclude categories', 'merchant' ),
342 + 'source' => 'options',
343 + 'multiple' => true,
344 + 'options' => Merchant_Admin_Options::get_category_select2_choices(),
345 + 'placeholder' => esc_html__( 'Search categories', 'merchant' ),
346 + 'desc' => esc_html__( 'Upsell will not be displayed for selected category products.', 'merchant' ),
347 + 'conditions' => array(
348 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
349 + 'terms' => array(
350 + array(
351 + 'field' => 'upsell_based_on', // field ID
352 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
353 + 'value' => 'all', // can be a single value or an array of string/number/int
354 + ),
355 + array(
356 + 'field' => 'exclusion_toggle', // field ID
357 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
358 + 'value' => true, // can be a single value or an array of string/number/int
359 + ),
360 + ),
361 + ),
362 + 'ai_meta' => array(
363 + 'entity' => 'category',
364 + 'reference_type' => 'dynamic',
365 + 'taxonomy' => 'product_cat',
366 + 'value_format' => 'slug',
367 + 'semantic_group' => 'product_exclusion',
368 + 'abstraction_level' => 3,
369 + 'toggled_by' => 'exclusion_toggle',
370 + 'usage_hint' => 'Cart products from these categories will NOT trigger this upsell. Dynamic: future products in the category are automatically excluded. Requires exclusion_toggle=true and upsell_based_on=all.',
371 + ),
372 + ),
373 + array(
374 + 'id' => 'include_subcategories',
375 + 'type' => 'switcher',
376 + 'title' => esc_html__( 'Include subcategories', 'merchant' ),
377 + 'desc' => esc_html__( 'When enabled, selecting a parent category also applies to all of its child categories.', 'merchant' ),
378 + 'default' => 0,
379 + 'conditions' => array(
380 + 'relation' => 'OR',
381 + 'terms' => array(
382 + array(
383 + 'field' => 'upsell_based_on',
384 + 'operator' => '===',
385 + 'value' => 'categories',
386 + ),
387 + array(
388 + 'field' => 'exclusion_toggle',
389 + 'operator' => '===',
390 + 'value' => true,
391 + ),
392 + ),
393 + ),
394 + 'ai_meta' => array(
395 + 'semantic_group' => 'product_targeting',
396 + 'usage_hint' => 'Enable so selected parent categories also cover their child categories, for both the upsell trigger and the category exclusion. Off by default, which matches only the exact categories chosen. Does not affect which products are recommended.',
397 + ),
398 + ),
399 + array(
400 + 'id' => 'custom_upsell_type',
401 + 'type' => 'select',
402 + 'title' => esc_html__( 'Trigger upsells', 'merchant' ),
403 + 'options' => array(
404 + 'products' => esc_html__( 'Specific product', 'merchant' ),
405 + 'categories' => esc_html__( 'Specific category', 'merchant' ),
406 + ),
407 + 'default' => 'products',
408 + 'ai_meta' => array(
409 + 'usage_hint' => 'Controls whether the recommended upsell products are selected individually or by category. Set this BEFORE setting upsells_product_ids or upsells_category_slugs.',
410 + ),
411 + ),
412 + array(
413 + 'id' => 'upsells_product_ids',
414 + 'type' => 'products_selector',
415 + 'title' => esc_html__( 'Select product(s)', 'merchant' ),
416 + 'multiple' => true,
417 + 'desc' => esc_html__( 'Select the product(s) that you want to add the upsell for', 'merchant' ),
418 + 'allowed_types' => array( 'simple', 'variable' ),
419 + 'conditions' => array(
420 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
421 + 'terms' => array(
422 + array(
423 + 'field' => 'custom_upsell_type', // field ID
424 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
425 + 'value' => 'products', // can be a single value or an array of string/number/int
426 + ),
427 + ),
428 + ),
429 + 'ai_meta' => array(
430 + 'entity' => 'product',
431 + 'reference_type' => 'static',
432 + 'value_format' => 'product_id',
433 + 'usage_hint' => 'The specific products to recommend as upsells. Requires custom_upsell_type=products.',
434 + ),
435 + ),
436 + array(
437 + 'id' => 'upsells_category_slugs',
438 + 'type' => 'select_ajax',
439 + 'title' => esc_html__( 'Select categories', 'merchant' ),
440 + 'source' => 'options',
441 + 'multiple' => true,
442 + 'options' => Merchant_Admin_Options::get_category_select2_choices(),
443 + 'placeholder' => esc_html__( 'Search categories', 'merchant' ),
444 + 'desc' => esc_html__( 'Select the categories that you want to display the upsell products from.', 'merchant' ),
445 + 'conditions' => array(
446 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
447 + 'terms' => array(
448 + array(
449 + 'field' => 'custom_upsell_type', // field ID
450 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
451 + 'value' => 'categories', // can be a single value or an array of string/number/int
452 + ),
453 + ),
454 + ),
455 + 'ai_meta' => array(
456 + 'entity' => 'category',
457 + 'reference_type' => 'dynamic',
458 + 'taxonomy' => 'product_cat',
459 + 'value_format' => 'slug',
460 + 'usage_hint' => 'Recommend products from these categories as upsells. Requires custom_upsell_type=categories.',
461 + ),
462 + ),
463 + ),
464 + ),
465 + ),
466 + ),
467 +
468 + array(
469 + 'id' => 'upsells_products_count_limitation_toggle',
470 + 'label' => esc_html__( 'Limit the number of upsells in the cart', 'merchant' ),
471 + 'type' => 'checkbox',
472 + 'default' => 0,
473 + 'conditions' => array(
474 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
475 + 'terms' => array(
476 + array(
477 + 'field' => 'use_upsells', // field ID
478 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
479 + 'value' => true, // can be a single value or an array of string/number/int
480 + ),
481 + ),
482 + ),
483 + ),
484 + array(
485 + 'id' => 'upsells_products_count_limitation',
486 + 'title' => esc_html__( 'Maximum number of upsells to display', 'merchant' ),
487 + 'type' => 'number',
488 + 'default' => 5,
489 + 'min' => 1,
490 + 'step' => 1,
491 + 'conditions' => array(
492 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
493 + 'terms' => array(
494 + array(
495 + 'field' => 'use_upsells', // field ID
496 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
497 + 'value' => true, // can be a single value or an array of string/number/int
498 + ),
499 + array(
500 + 'field' => 'upsells_products_count_limitation_toggle', // field ID
501 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
502 + 'value' => true, // can be a single value or an array of string/number/int
503 + ),
504 + ),
505 + ),
506 + ),
507 + array(
508 + 'id' => 'upsells_title',
509 + 'title' => esc_html__( 'Upsell title', 'merchant' ),
510 + 'type' => 'text',
511 + 'default' => esc_html__( 'You might also like', 'merchant' ),
512 + 'conditions' => array(
513 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
514 + 'terms' => array(
515 + array(
516 + 'field' => 'use_upsells', // field ID
517 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
518 + 'value' => true, // can be a single value or an array of string/number/int
519 + ),
520 + ),
521 + ),
522 + ),
523 + array(
524 + 'id' => 'upsells_add_to_cart_text',
525 + 'title' => esc_html__( 'Button text', 'merchant' ),
526 + 'type' => 'text',
527 + 'default' => esc_html__( 'Add', 'merchant' ),
528 + 'conditions' => array(
529 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
530 + 'terms' => array(
531 + array(
532 + 'field' => 'use_upsells', // field ID
533 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
534 + 'value' => true, // can be a single value or an array of string/number/int
535 + ),
536 + ),
537 + ),
538 + ),
539 + array(
540 + 'id' => 'upsells_style',
541 + 'type' => 'select',
542 + 'title' => esc_html__( 'Upsell layout', 'merchant' ),
543 + 'options' => array(
544 + 'carousel' => esc_html__( 'Carousel', 'merchant' ),
545 + 'block' => esc_html__( 'List', 'merchant' ),
546 + ),
547 + 'default' => 'block',
548 + 'conditions' => array(
549 + 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
550 + 'terms' => array(
551 + array(
552 + 'field' => 'use_upsells', // field ID
553 + 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
554 + 'value' => true, // can be a single value or an array of string/number/int
555 + ),
556 + ),
557 + ),
558 + ),
559 + ),
560 +),
561 + array(
562 + 'module' => Merchant_Side_Cart::MODULE_ID,
563 + 'title' => esc_html__( 'Floating Mini Cart', 'merchant' ),
564 + 'fields' => array(
565 + array(
566 + 'id' => 'enable-floating-cart',
567 + 'type' => 'switcher',
568 + 'title' => esc_html__( 'Floating cart', 'merchant' ),
569 + 'desc' => esc_html__( 'Enable floating cart icon', 'merchant' ),
570 + 'default' => 0,
571 + ),
572 +
573 + array(
574 + 'id' => 'icon-display',
575 + 'type' => 'select',
576 + 'title' => esc_html__( 'Display', 'merchant' ),
577 + 'options' => array(
578 + 'cart-not-empty' => esc_html__( 'When cart is not empty', 'merchant' ),
579 + 'always' => esc_html__( 'Always', 'merchant' ),
580 + ),
581 + 'default' => 'always',
582 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
583 + ),
584 +
585 + array(
586 + 'id' => 'icon',
587 + 'type' => 'choices',
588 + 'title' => esc_html__( 'Icon', 'merchant' ),
589 + 'options' => array(
590 + 'cart-icon-1' => MERCHANT_URI . 'assets/images/icons/side-cart/admin/cart-icon-1.svg',
591 + 'cart-icon-2' => MERCHANT_URI . 'assets/images/icons/side-cart/admin/cart-icon-2.svg',
592 + 'cart-icon-3' => MERCHANT_URI . 'assets/images/icons/side-cart/admin/cart-icon-3.svg',
593 + 'cart-icon-4' => MERCHANT_URI . 'assets/images/icons/side-cart/admin/cart-icon-4.svg',
594 + 'cart-icon-5' => MERCHANT_URI . 'assets/images/icons/side-cart/admin/cart-icon-5.svg',
595 + ),
596 + 'default' => 'cart-icon-1',
597 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
598 + ),
599 +
600 + array(
601 + 'id' => 'icon-position',
602 + 'type' => 'radio',
603 + 'title' => esc_html__( 'Position', 'merchant' ),
604 + 'options' => array(
605 + 'left' => esc_html__( 'Left', 'merchant' ),
606 + 'right' => esc_html__( 'Right', 'merchant' ),
607 + ),
608 + 'default' => 'right',
609 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
610 + ),
611 +
612 + array(
613 + 'id' => 'icon-size',
614 + 'type' => 'range',
615 + 'title' => esc_html__( 'Icon size', 'merchant' ),
616 + 'min' => 0,
617 + 'max' => 250,
618 + 'step' => 1,
619 + 'default' => 25,
620 + 'unit' => 'px',
621 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
622 + ),
623 +
624 + array(
625 + 'id' => 'icon-corner-offset',
626 + 'type' => 'range',
627 + 'title' => esc_html__( 'Corner offset', 'merchant' ),
628 + 'min' => 0,
629 + 'max' => 250,
630 + 'step' => 1,
631 + 'default' => 30,
632 + 'unit' => 'px',
633 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
634 + ),
635 +
636 + array(
637 + 'id' => 'icon-border-radius',
638 + 'type' => 'range',
639 + 'title' => esc_html__( 'Border radius', 'merchant' ),
640 + 'min' => 0,
641 + 'max' => 35,
642 + 'step' => 1,
643 + 'default' => 35,
644 + 'unit' => 'px',
645 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
646 + ),
647 +
648 + array(
649 + 'id' => 'icon-color',
650 + 'type' => 'color',
651 + 'title' => esc_html__( 'Icon color', 'merchant' ),
652 + 'default' => '#ffffff',
653 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
654 + ),
655 +
656 + array(
657 + 'id' => 'icon-background-color',
658 + 'type' => 'color',
659 + 'title' => esc_html__( 'Background color', 'merchant' ),
660 + 'default' => '#212121',
661 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
662 + ),
663 +
664 + array(
665 + 'id' => 'icon-counter-color',
666 + 'type' => 'color',
667 + 'title' => esc_html__( 'Counter color', 'merchant' ),
668 + 'default' => '#ffffff',
669 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
670 + ),
671 +
672 + array(
673 + 'id' => 'icon-counter-background-color',
674 + 'type' => 'color',
675 + 'title' => esc_html__( 'Counter background color', 'merchant' ),
676 + 'default' => '#757575',
677 + 'condition' => array( 'enable-floating-cart', '==', '1' ),
678 + ),
679 + ),
680 +),
681 + array(
682 + 'module' => Merchant_Side_Cart::MODULE_ID,
683 + 'title' => esc_html__( 'Look and Feel', 'merchant' ),
684 + 'fields' => array(
685 +
686 + array(
687 + 'id' => 'side-cart-width',
688 + 'type' => 'range',
689 + 'title' => esc_html__( 'Side cart width', 'merchant' ),
690 + 'min' => 0,
691 + 'max' => 2000,
692 + 'step' => 1,
693 + 'default' => 380,
694 + 'unit' => 'px',
695 + ),
696 +
697 + array(
698 + 'id' => 'side-cart-title-color',
699 + 'type' => 'color',
700 + 'title' => esc_html__( 'Title color', 'merchant' ),
701 + 'default' => '#212121',
702 + ),
703 +
704 + array(
705 + 'id' => 'side-cart-title-icon-color',
706 + 'type' => 'color',
707 + 'title' => esc_html__( 'Title icon color', 'merchant' ),
708 + 'default' => '#212121',
709 + ),
710 +
711 + array(
712 + 'id' => 'side-cart-title-background-color',
713 + 'type' => 'color',
714 + 'title' => esc_html__( 'Title background color', 'merchant' ),
715 + 'default' => '#cccccc',
716 + ),
717 +
718 + array(
719 + 'id' => 'side-cart-content-text-color',
720 + 'type' => 'color',
721 + 'title' => esc_html__( 'Content text color', 'merchant' ),
722 + 'default' => '#212121',
723 + ),
724 +
725 + array(
726 + 'id' => 'side-cart-content-background-color',
727 + 'type' => 'color',
728 + 'title' => esc_html__( 'Content background color', 'merchant' ),
729 + 'default' => '#ffffff',
730 + ),
731 +
732 + array(
733 + 'id' => 'side-cart-content-remove-color',
734 + 'type' => 'color',
735 + 'title' => esc_html__( 'Content (x) color', 'merchant' ),
736 + 'default' => '#ffffff',
737 + ),
738 +
739 + array(
740 + 'id' => 'side-cart-content-remove-background-color',
741 + 'type' => 'color',
742 + 'title' => esc_html__( 'Content (x) background color', 'merchant' ),
743 + 'default' => '#212121',
744 + ),
745 +
746 + array(
747 + 'id' => 'side-cart-total-text-color',
748 + 'type' => 'color',
749 + 'title' => esc_html__( 'Total text color', 'merchant' ),
750 + 'default' => '#212121',
751 + ),
752 +
753 + array(
754 + 'id' => 'side-cart-total-background-color',
755 + 'type' => 'color',
756 + 'title' => esc_html__( 'Total background color', 'merchant' ),
757 + 'default' => '#f5f5f5',
758 + ),
759 +
760 + array(
761 + 'id' => 'side-cart-button-color',
762 + 'type' => 'color',
763 + 'title' => esc_html__( 'Button color', 'merchant' ),
764 + 'default' => '#ffffff',
765 + ),
766 +
767 + array(
768 + 'id' => 'side-cart-button-color-hover',
769 + 'type' => 'color',
770 + 'title' => esc_html__( 'Button color hover', 'merchant' ),
771 + 'default' => '#ffffff',
772 + ),
773 +
774 + array(
775 + 'id' => 'side-cart-button-border-color',
776 + 'type' => 'color',
777 + 'title' => esc_html__( 'Button border color', 'merchant' ),
778 + 'default' => '#212121',
779 + ),
780 +
781 + array(
782 + 'id' => 'side-cart-button-border-color-hover',
783 + 'type' => 'color',
784 + 'title' => esc_html__( 'Button border color hover', 'merchant' ),
785 + 'default' => '#313131',
786 + ),
787 +
788 + array(
789 + 'id' => 'side-cart-button-background-color',
790 + 'type' => 'color',
791 + 'title' => esc_html__( 'Button background color', 'merchant' ),
792 + 'default' => '#212121',
793 + ),
794 +
795 + array(
796 + 'id' => 'side-cart-button-background-color-hover',
797 + 'type' => 'color',
798 + 'title' => esc_html__( 'Button background color hover', 'merchant' ),
799 + 'default' => '#313131',
800 + ),
801 + ),
802 +),
803 +);