PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.0
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.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 / spending-goal / admin / options.php

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

464 lines 14.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Spending Goal — 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 // Settings
17
18 return array(
19 array(
20 'title' => esc_html__( 'Settings', 'merchant' ),
21 'module' => Merchant_Spending_Goal::MODULE_ID,
22 'fields' => array(
23
24 array(
25 'id' => 'spending_goal',
26 'type' => 'number',
27 'title' => esc_html__( 'Spending goal', 'merchant' ),
28 'step' => 0.01,
29 'default' => 150,
30 'ai_meta' => array(
31 'semantic_group' => 'offer_rules',
32 'usage_hint' => 'The cart total threshold the customer must reach to unlock the spending goal discount.',
33 ),
34 ),
35
36 array(
37 'id' => 'total_type',
38 'type' => 'select',
39 'title' => esc_html__( 'Based on', 'merchant' ),
40 'desc' => esc_html__( 'Choose the basis for the spending goal. “Cart Subtotal” excludes additional calculated discounts, whereas “Cart Total” includes them.', 'merchant' ),
41 'options' => array(
42 'subtotal' => esc_html__( 'Cart subtotal', 'merchant' ),
43 'total' => esc_html__( 'Cart total', 'merchant' ),
44 ),
45 'default' => 'subtotal',
46 'ai_meta' => array(
47 'semantic_group' => 'offer_rules',
48 'usage_hint' => 'Determines whether the spending_goal threshold is compared against the cart subtotal (pre-discount) or cart total (post-discount).',
49 ),
50 ),
51
52 array(
53 'id' => 'discount_type',
54 'type' => 'select',
55 'title' => esc_html__( 'Discount type', 'merchant' ),
56 'options' => array(
57 'percent' => esc_html__( 'Percent', 'merchant' ),
58 'fixed' => esc_html__( 'Fixed amount', 'merchant' ),
59 ),
60 'default' => 'percent',
61 'ai_meta' => array(
62 'semantic_group' => 'offer_rules',
63 'usage_hint' => 'Type of discount granted when the spending goal is reached. percent = percentage off cart total; fixed = fixed amount off.',
64 ),
65 ),
66
67 array(
68 'id' => 'discount_amount',
69 'type' => 'number',
70 'title' => esc_html__( 'Discount amount', 'merchant' ),
71 'step' => 0.01,
72 'default' => 10,
73 'ai_meta' => array(
74 'semantic_group' => 'offer_rules',
75 'usage_hint' => 'Amount of the discount applied when the spending goal is reached. Interpretation depends on discount_type.',
76 ),
77 ),
78
79 array(
80 'id' => 'discount_name',
81 'type' => 'text',
82 'title' => esc_html__( 'Discount name', 'merchant' ),
83 'default' => esc_html__( 'Spending goal', 'merchant' ),
84 'desc' => esc_html__( 'This will be the name of the applied discount on the cart page.', 'merchant' ),
85 ),
86
87 array(
88 'id' => 'inclusion',
89 'type' => 'switcher',
90 'title' => esc_html__( 'Product Inclusion', 'merchant' ),
91 'desc' => esc_html__( 'Include only certain products or categories', 'merchant' ),
92 'default' => 0,
93 'ai_meta' => array(
94 'toggle_for' => 'included_products',
95 'semantic_group' => 'product_targeting',
96 'usage_hint' => 'Enable this to count only specific products or categories toward the spending goal. Reveals included_products and included_categories.',
97 ),
98 ),
99
100 array(
101 'id' => 'included_products',
102 'type' => 'products_selector',
103 'title' => esc_html__( 'Include Products', 'merchant' ),
104 'multiple' => true,
105 'conditions' => array(
106 'relation' => 'AND',
107 'terms' => array(
108 array(
109 'field' => 'inclusion',
110 'operator' => '===',
111 'value' => true,
112 ),
113 ),
114 ),
115 'ai_meta' => array(
116 'entity' => 'product',
117 'reference_type' => 'static',
118 'value_format' => 'product_id',
119 'semantic_group' => 'product_targeting',
120 'abstraction_level' => 1,
121 'toggled_by' => 'inclusion',
122 'usage_hint' => 'Products counted toward the spending goal. Requires inclusion to be enabled.',
123 ),
124 ),
125
126 array(
127 'id' => 'included_categories',
128 'type' => 'select_ajax',
129 'title' => esc_html__( 'Include Categories', 'merchant' ),
130 'source' => 'options',
131 'multiple' => true,
132 'options' => Merchant_Admin_Options::get_category_select2_choices(),
133 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
134 'conditions' => array(
135 'relation' => 'AND',
136 'terms' => array(
137 array(
138 'field' => 'inclusion',
139 'operator' => '===',
140 'value' => true,
141 ),
142 ),
143 ),
144 'ai_meta' => array(
145 'entity' => 'category',
146 'reference_type' => 'dynamic',
147 'taxonomy' => 'product_cat',
148 'value_format' => 'slug',
149 'semantic_group' => 'product_targeting',
150 'abstraction_level' => 3,
151 'toggled_by' => 'inclusion',
152 'usage_hint' => 'Categories counted toward the spending goal. Requires inclusion to be enabled.',
153 ),
154 ),
155
156 array(
157 'id' => 'exclusion',
158 'type' => 'switcher',
159 'title' => esc_html__( 'Product Exclusion', 'merchant' ),
160 'desc' => esc_html__( 'Exclude certain products or categories', 'merchant' ),
161 'default' => 0,
162 'ai_meta' => array(
163 'toggle_for' => 'excluded_products',
164 'semantic_group' => 'product_exclusion',
165 'usage_hint' => 'Enable this to exclude specific products or categories from counting toward the spending goal. Reveals excluded_products and excluded_categories.',
166 ),
167 ),
168
169 array(
170 'id' => 'excluded_products',
171 'type' => 'products_selector',
172 'title' => esc_html__( 'Exclude Products', 'merchant' ),
173 'multiple' => true,
174 'conditions' => array(
175 'relation' => 'AND',
176 'terms' => array(
177 array(
178 'field' => 'exclusion',
179 'operator' => '===',
180 'value' => true,
181 ),
182 ),
183 ),
184 'ai_meta' => array(
185 'entity' => 'product',
186 'reference_type' => 'static',
187 'value_format' => 'product_id',
188 'semantic_group' => 'product_exclusion',
189 'abstraction_level' => 1,
190 'toggled_by' => 'exclusion',
191 'usage_hint' => 'Products excluded from counting toward the spending goal. Requires exclusion to be enabled.',
192 ),
193 ),
194
195 array(
196 'id' => 'excluded_categories',
197 'type' => 'select_ajax',
198 'title' => esc_html__( 'Exclude Categories', 'merchant' ),
199 'source' => 'options',
200 'multiple' => true,
201 'options' => Merchant_Admin_Options::get_category_select2_choices(),
202 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
203 'conditions' => array(
204 'relation' => 'AND',
205 'terms' => array(
206 array(
207 'field' => 'exclusion',
208 'operator' => '===',
209 'value' => true,
210 ),
211 ),
212 ),
213 'ai_meta' => array(
214 'entity' => 'category',
215 'reference_type' => 'dynamic',
216 'taxonomy' => 'product_cat',
217 'value_format' => 'slug',
218 'semantic_group' => 'product_exclusion',
219 'abstraction_level' => 3,
220 'toggled_by' => 'exclusion',
221 'usage_hint' => 'Categories excluded from counting toward the spending goal. Requires exclusion to be enabled.',
222 ),
223 ),
224
225 array(
226 'id' => 'user_condition',
227 'type' => 'select',
228 'title' => esc_html__( 'User Condition', 'merchant' ),
229 'options' => array(
230 'all' => esc_html__( 'All Users', 'merchant' ),
231 'customers' => esc_html__( 'Selected Users', 'merchant' ),
232 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
233 ),
234 'default' => 'all',
235 'ai_meta' => array(
236 'semantic_group' => 'user_targeting',
237 'usage_hint' => 'Controls which users are eligible for this spending goal discount. Set this BEFORE setting user_condition_users or user_condition_roles.',
238 ),
239 ),
240
241 array(
242 'id' => 'user_condition_roles',
243 'type' => 'select_ajax',
244 'title' => esc_html__( 'User Roles', 'merchant' ),
245 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
246 'source' => 'options',
247 'multiple' => true,
248 'classes' => array( 'flex-grow' ),
249 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
250 'condition' => array( 'user_condition', '==', 'roles' ),
251 'ai_meta' => array(
252 'entity' => 'role',
253 'reference_type' => 'dynamic',
254 'value_format' => 'role_slug',
255 'semantic_group' => 'user_targeting',
256 'abstraction_level' => 2,
257 'usage_hint' => 'Roles eligible for the spending goal discount. Only used when user_condition is roles.',
258 ),
259 ),
260
261 array(
262 'id' => 'user_condition_users',
263 'type' => 'select_ajax',
264 'title' => esc_html__( 'Users', 'merchant' ),
265 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
266 'source' => 'user',
267 'multiple' => true,
268 'classes' => array( 'flex-grow' ),
269 'condition' => array( 'user_condition', '==', 'customers' ),
270 'ai_meta' => array(
271 'entity' => 'user',
272 'reference_type' => 'static',
273 'value_format' => 'user_id',
274 'semantic_group' => 'user_targeting',
275 'abstraction_level' => 1,
276 'usage_hint' => 'Specific users eligible for the spending goal discount. Only used when user_condition is customers.',
277 ),
278 ),
279
280 array(
281 'id' => 'user_exclusion_enabled',
282 'type' => 'switcher',
283 'title' => esc_html__( 'Exclusion List', 'merchant' ),
284 'desc' => esc_html__( 'Choose the users who will not see this offer.', 'merchant' ),
285 'default' => 0,
286 'conditions' => array(
287 'relation' => 'AND',
288 'terms' => array(
289 array(
290 'field' => 'user_condition',
291 'operator' => 'in',
292 'value' => array( 'all', 'roles' ),
293 ),
294 ),
295 ),
296 'ai_meta' => array(
297 'toggle_for' => 'exclude_roles',
298 'semantic_group' => 'user_exclusion',
299 'usage_hint' => 'Enable this to reveal exclude_users and exclude_roles fields.',
300 ),
301 ),
302
303 array(
304 'id' => 'exclude_users',
305 'type' => 'select_ajax',
306 'title' => esc_html__( 'Exclude Users', 'merchant' ),
307 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
308 'source' => 'user',
309 'multiple' => true,
310 'classes' => array( 'flex-grow' ),
311 'conditions' => array(
312 'relation' => 'AND',
313 'terms' => array(
314 array(
315 'field' => 'user_condition',
316 'operator' => 'in',
317 'value' => array( 'all', 'roles' ),
318 ),
319 array(
320 'field' => 'user_exclusion_enabled',
321 'operator' => '===',
322 'value' => true,
323 ),
324 ),
325 ),
326 'ai_meta' => array(
327 'entity' => 'user',
328 'reference_type' => 'static',
329 'value_format' => 'user_id',
330 'semantic_group' => 'user_exclusion',
331 'abstraction_level' => 1,
332 'toggled_by' => 'user_exclusion_enabled',
333 'usage_hint' => 'Users excluded from the spending goal discount. Requires user_exclusion_enabled.',
334 ),
335 ),
336
337 array(
338 'id' => 'exclude_roles',
339 'type' => 'select_ajax',
340 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
341 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
342 'source' => 'options',
343 'multiple' => true,
344 'classes' => array( 'flex-grow' ),
345 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
346 'conditions' => array(
347 'relation' => 'AND',
348 'terms' => array(
349 array(
350 'field' => 'user_condition',
351 'operator' => 'in',
352 'value' => array( 'all' ),
353 ),
354 array(
355 'field' => 'user_exclusion_enabled',
356 'operator' => '===',
357 'value' => true,
358 ),
359 ),
360 ),
361 'ai_meta' => array(
362 'entity' => 'role',
363 'reference_type' => 'dynamic',
364 'value_format' => 'role_slug',
365 'semantic_group' => 'user_exclusion',
366 'abstraction_level' => 2,
367 'toggled_by' => 'user_exclusion_enabled',
368 'usage_hint' => 'Roles excluded from the spending goal discount. Requires user_exclusion_enabled.',
369 ),
370 ),
371
372 array(
373 'id' => 'enable_auto_slide_in',
374 'type' => 'switcher',
375 'title' => esc_html__( 'Enable Auto Slide In', 'merchant' ),
376 'desc' => esc_html__( 'This will make the widget slide in each time a product is added to the cart.', 'merchant' ),
377 'default' => 1,
378 ),
379 ),
380 ),
381 array(
382 'title' => esc_html__( 'Text Formatting Settings', 'merchant' ),
383 'module' => Merchant_Spending_Goal::MODULE_ID,
384 'fields' => array(
385
386 array(
387 'id' => 'text_goal_zero',
388 'type' => 'text',
389 'title' => esc_html__( 'When the goal target is at 0%', 'merchant' ),
390 'default' => esc_html__( 'Spend {spending_goal} to get a {discount_amount} discount!', 'merchant' ),
391 'desc' => esc_html__( 'Default is: Spend {spending_goal} to get a {discount_amount} discount!', 'merchant' ),
392 ),
393
394 array(
395 'id' => 'text_goal_started',
396 'type' => 'text',
397 'title' => esc_html__( 'When the goal target is between 1-99%', 'merchant' ),
398 'default' => esc_html__( 'Spend {spending_goal} more to get a {discount_amount} discount!', 'merchant' ),
399 'desc' => esc_html__( 'Default is: Spend {spending_goal} more to get a {discount_amount} discount!', 'merchant' ),
400 ),
401
402 array(
403 'id' => 'text_goal_reached',
404 'type' => 'text',
405 'title' => esc_html__( 'When the goal target is at 100%', 'merchant' ),
406 'default' => esc_html__( 'Congratulations! You got a discount of {discount_amount} on this order!', 'merchant' ),
407 'desc' => esc_html__( 'Default: Congratulations! You got a discount of {discount_amount} on this order!', 'merchant' ),
408 ),
409 ),
410 ),
411 array(
412 'module' => Merchant_Spending_Goal::MODULE_ID,
413 'title' => esc_html__( 'Style', 'merchant' ),
414 'fields' => array(
415
416 array(
417 'id' => 'gradient_start',
418 'type' => 'color',
419 'title' => esc_html__( 'Gradient start', 'merchant' ),
420 'default' => '#5e5e5e',
421 ),
422
423 array(
424 'id' => 'gradient_end',
425 'type' => 'color',
426 'title' => esc_html__( 'Gradient end', 'merchant' ),
427 'default' => '#212121',
428 ),
429
430 array(
431 'id' => 'progress_bar',
432 'type' => 'color',
433 'title' => esc_html__( 'Progress bar color', 'merchant' ),
434 'default' => '#d83a3b',
435 ),
436
437 array(
438 'id' => 'content_width',
439 'type' => 'range',
440 'title' => esc_html__( 'Content width', 'merchant' ),
441 'min' => 0,
442 'max' => 600,
443 'step' => 1,
444 'unit' => 'px',
445 'default' => 300,
446 ),
447
448 array(
449 'id' => 'content_bg_color',
450 'type' => 'color',
451 'title' => esc_html__( 'Content background color', 'merchant' ),
452 'default' => '#f9f9f9',
453 ),
454
455 array(
456 'id' => 'content_text_color',
457 'type' => 'color',
458 'title' => esc_html__( 'Content text color', 'merchant' ),
459 'default' => '#3c434a',
460 ),
461 ),
462 ),
463 );
464