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
merchant / inc / modules / free-gifts / admin / options.php

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

985 lines 34.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Free Gifts — 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 'title' => esc_html__( 'Floating Gift Widget', 'merchant' ),
19 'module' => Merchant_Free_Gifts::MODULE_ID,
20 'fields' => array(
21 array(
22 'id' => 'offers',
23 'type' => 'flexible_content',
24 'button_label' => esc_html__( 'Add New Offer', 'merchant' ),
25 'style' => Merchant_Free_Gifts::MODULE_ID . '-style default',
26 'sorting' => true,
27 'accordion' => true,
28 'duplicate' => true,
29 'layouts' => array(
30 'spending' => array(
31 'title' => esc_html__( 'Spending Based', 'merchant' ),
32 'title-field' => 'offer-title', // text field ID to use as title for the layout
33 'status-field' => 'campaign_status',
34 'fields' => array(
35 array(
36 'id' => 'campaign_status',
37 'type' => 'select',
38 'title' => esc_html__( 'Status', 'merchant' ),
39 'options' => array(
40 'active' => esc_html__( 'Active', 'merchant' ),
41 'inactive' => esc_html__( 'Inactive', 'merchant' ),
42 ),
43 'default' => 'active',
44 'ai_meta' => array(
45 'usage_hint' => 'Controls whether this campaign is active or inactive. Set to active to enable, inactive to disable.',
46 ),
47
48 ),
49 array(
50 'id' => 'offer-title',
51 'type' => 'text',
52 'title' => esc_html__( 'Offer name', 'merchant' ),
53 'default' => esc_html__( 'Free Gift Campaign', 'merchant' ),
54 ),
55 array(
56 'id' => 'rules_to_apply',
57 'type' => 'select',
58 'title' => esc_html__( 'Products that can be purchased to claim the gift', 'merchant' ),
59 'options' => array(
60 'all' => esc_html__( 'All Products', 'merchant' ),
61 'product' => esc_html__( 'Specific Products', 'merchant' ),
62 'categories' => esc_html__( 'Specific Categories', 'merchant' ),
63 'tags' => esc_html__( 'Specific Tags', 'merchant' ),
64 'brands' => esc_html__( 'Specific Brands', 'merchant' ),
65 ),
66 'default' => 'all',
67 'ai_meta' => array(
68 'semantic_group' => 'product_targeting',
69 'usage_hint' => 'Controls which products this campaign applies to. Set this BEFORE setting product_to_display, category_slugs, tag_slugs, or brand_slugs — those fields are conditional on this value.',
70 ),
71
72 ),
73
74 array(
75 'id' => 'product_to_purchase',
76 'type' => 'products_selector',
77 'multiple' => false,
78 'desc' => esc_html__( 'Select the products that the spending goal will apply to.', 'merchant' ),
79 'condition' => array( 'rules_to_apply', '==', 'product' ),
80 'allowed_types' => array( 'simple', 'variable' ),
81 'ai_meta' => array(
82 'entity' => 'product',
83 'reference_type' => 'static',
84 'value_format' => 'product_id',
85 'semantic_group' => 'product_targeting',
86 'abstraction_level' => 1,
87 'usage_hint' => 'Use when targeting specific individual products by name or SKU. Requires rules_to_apply=products.',
88 ),
89
90 ),
91
92 array(
93 'id' => 'category_slugs',
94 'type' => 'select_ajax',
95 'title' => esc_html__( 'Categories', 'merchant' ),
96 'source' => 'options',
97 'multiple' => true,
98 'options' => Merchant_Admin_Options::get_category_select2_choices(),
99 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
100 'desc' => esc_html__( 'Select the product categories that the spending goal will apply to.', 'merchant' ),
101 'condition' => array( 'rules_to_apply', '==', 'categories' ),
102 'ai_meta' => array(
103 'entity' => 'category',
104 'reference_type' => 'dynamic',
105 'taxonomy' => 'product_cat',
106 'value_format' => 'slug',
107 'semantic_group' => 'product_targeting',
108 'abstraction_level' => 3,
109 'usage_hint' => 'Use when targeting products by category. Dynamic: future products added to the category are included. Requires rules_to_display=categories.',
110 ),
111
112 ),
113
114 array(
115 'id' => 'tag_slugs',
116 'type' => 'select_ajax',
117 'title' => esc_html__( 'Tags', 'merchant' ),
118 'source' => 'options',
119 'multiple' => true,
120 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
121 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
122 'desc' => esc_html__( 'Select the product tags that the spending goal will apply to.', 'merchant' ),
123 'condition' => array( 'rules_to_apply', '==', 'tags' ),
124 'ai_meta' => array(
125 'entity' => 'tag',
126 'reference_type' => 'dynamic',
127 'taxonomy' => 'product_tag',
128 'value_format' => 'slug',
129 'semantic_group' => 'product_targeting',
130 'abstraction_level' => 2,
131 'usage_hint' => 'Use when targeting products by tag. Dynamic: future products added to the tag are included. Requires rules_to_display=tags.',
132 ),
133
134 ),
135 array(
136 'id' => 'brand_slugs',
137 'type' => 'select_ajax',
138 'title' => esc_html__( 'Brands', 'merchant' ),
139 'source' => 'options',
140 'multiple' => true,
141 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
142 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
143 'desc' => esc_html__( 'Select the product brands that the spending goal will apply to.', 'merchant' ),
144 'condition' => array( 'rules_to_apply', '==', 'brands' ),
145 'ai_meta' => array(
146 'entity' => 'brand',
147 'reference_type' => 'dynamic',
148 'taxonomy' => 'product_brand',
149 'value_format' => 'slug',
150 'semantic_group' => 'product_targeting',
151 'abstraction_level' => 4,
152 'usage_hint' => 'Use when targeting products by brand. Dynamic: future products added to the brand are included. Requires rules_to_display=brands.',
153 ),
154
155 ),
156
157 array(
158 'id' => 'exclude_products_toggle',
159 'type' => 'switcher',
160 'title' => esc_html__( 'Exclude Products', 'merchant' ),
161 'desc' => esc_html__( 'Exclude specific products from this campaign.', 'merchant' ),
162 'default' => 0,
163 'conditions' => array(
164 'relation' => 'AND',
165 'terms' => array(
166 array(
167 'field' => 'rules_to_apply',
168 'operator' => 'in',
169 'value' => array( 'all', 'categories', 'tags', 'brands' ),
170 ),
171 ),
172 ),
173 'ai_meta' => array(
174 'toggle_for' => 'excluded_products',
175 'semantic_group' => 'product_exclusion',
176 'usage_hint' => 'Enable this toggle before setting excluded_products. Only available when rules_to_display is all, categories, tags, or brands.',
177 ),
178
179 ),
180
181 array(
182 'id' => 'excluded_products',
183 'type' => 'products_selector',
184 'title' => esc_html__( 'Excluded Products List', 'merchant' ),
185 'multiple' => true,
186 'desc' => esc_html__( 'Select the products that the spending goal will not apply to.', 'merchant' ),
187 'conditions' => array(
188 'relation' => 'AND',
189 'terms' => array(
190 array(
191 'field' => 'rules_to_apply',
192 'operator' => 'in',
193 'value' => array( 'all', 'categories', 'tags', 'brands' ),
194 ),
195 array(
196 'field' => 'exclude_products_toggle',
197 'operator' => '===',
198 'value' => true,
199 ),
200 ),
201 ),
202 'ai_meta' => array(
203 'entity' => 'product',
204 'reference_type' => 'static',
205 'value_format' => 'product_id',
206 'semantic_group' => 'product_exclusion',
207 'abstraction_level' => 1,
208 'toggled_by' => 'exclude_products_toggle',
209 'usage_hint' => 'Use ONLY for excluding specific individual products. For brand/category/tag exclusions, prefer excluded_brands/excluded_categories/excluded_tags.',
210 ),
211
212 ),
213
214 array(
215 'id' => 'exclude_categories_toggle',
216 'type' => 'switcher',
217 'title' => esc_html__( 'Exclude Categories', 'merchant' ),
218 'desc' => esc_html__( 'Exclude specific categories from this campaign.', 'merchant' ),
219 'default' => 0,
220 'conditions' => array(
221 'relation' => 'AND',
222 'terms' => array(
223 array(
224 'field' => 'rules_to_apply',
225 'operator' => 'in',
226 'value' => array( 'all', 'tags', 'brands' ),
227 ),
228 ),
229 ),
230 'ai_meta' => array(
231 'toggle_for' => 'excluded_categories',
232 'semantic_group' => 'product_exclusion',
233 'usage_hint' => 'Enable this toggle before setting excluded_categories. Only available when rules_to_display is all, tags, or brands.',
234 ),
235
236 ),
237
238 array(
239 'id' => 'excluded_categories',
240 'type' => 'select_ajax',
241 'title' => esc_html__( 'Excluded Categories List', 'merchant' ),
242 'source' => 'options',
243 'multiple' => true,
244 'options' => Merchant_Admin_Options::get_category_select2_choices(),
245 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
246 'desc' => esc_html__( 'Select the product categories that the spending goal will not apply to.', 'merchant' ),
247 'conditions' => array(
248 'relation' => 'AND',
249 'terms' => array(
250 array(
251 'field' => 'rules_to_apply',
252 'operator' => 'in',
253 'value' => array( 'all', 'tags', 'brands' ),
254 ),
255 array(
256 'field' => 'exclude_categories_toggle',
257 'operator' => '===',
258 'value' => true,
259 ),
260 ),
261 ),
262 'ai_meta' => array(
263 'entity' => 'category',
264 'reference_type' => 'dynamic',
265 'taxonomy' => 'product_cat',
266 'value_format' => 'slug',
267 'semantic_group' => 'product_exclusion',
268 'abstraction_level' => 3,
269 'toggled_by' => 'exclude_categories_toggle',
270 'usage_hint' => 'Use when excluding products by category. Dynamic: future products added to the category are automatically excluded.',
271 ),
272
273 ),
274
275 array(
276 'id' => 'include_subcategories',
277 'type' => 'switcher',
278 'title' => esc_html__( 'Include subcategories', 'merchant' ),
279 'desc' => esc_html__( 'When enabled, selecting a parent category also applies to all of its child categories.', 'merchant' ),
280 'default' => 0,
281 'conditions' => array(
282 'relation' => 'OR',
283 'terms' => array(
284 array(
285 'field' => 'rules_to_apply',
286 'operator' => '===',
287 'value' => 'categories',
288 ),
289 array(
290 'relation' => 'AND',
291 'terms' => array(
292 array(
293 'field' => 'rules_to_apply',
294 'operator' => 'in',
295 'value' => array( 'all', 'tags', 'brands' ),
296 ),
297 array(
298 'field' => 'exclude_categories_toggle',
299 'operator' => '===',
300 'value' => true,
301 ),
302 ),
303 ),
304 ),
305 ),
306 'ai_meta' => array(
307 'semantic_group' => 'product_targeting',
308 'usage_hint' => 'Enable so selected parent categories also cover their child categories, for both targeting and exclusion. Off by default, which matches only the exact categories chosen.',
309 ),
310
311 ),
312
313 array(
314 'id' => 'exclude_tags_toggle',
315 'type' => 'switcher',
316 'title' => esc_html__( 'Exclude Tags', 'merchant' ),
317 'desc' => esc_html__( 'Exclude specific tags from this campaign.', 'merchant' ),
318 'default' => 0,
319 'conditions' => array(
320 'relation' => 'AND',
321 'terms' => array(
322 array(
323 'field' => 'rules_to_apply',
324 'operator' => 'in',
325 'value' => array( 'all', 'categories', 'brands' ),
326 ),
327 ),
328 ),
329 'ai_meta' => array(
330 'toggle_for' => 'excluded_tags',
331 'semantic_group' => 'product_exclusion',
332 'usage_hint' => 'Enable this toggle before setting excluded_tags. Only available when rules_to_display is all, categories, or brands.',
333 ),
334
335 ),
336
337 array(
338 'id' => 'excluded_tags',
339 'type' => 'select_ajax',
340 'title' => esc_html__( 'Excluded Tags List', 'merchant' ),
341 'source' => 'options',
342 'multiple' => true,
343 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
344 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
345 'desc' => esc_html__( 'Select the product tags that the spending goal will not apply to.', 'merchant' ),
346 'conditions' => array(
347 'relation' => 'AND',
348 'terms' => array(
349 array(
350 'field' => 'rules_to_apply',
351 'operator' => 'in',
352 'value' => array( 'all', 'categories', 'brands' ),
353 ),
354 array(
355 'field' => 'exclude_tags_toggle',
356 'operator' => '===',
357 'value' => true,
358 ),
359 ),
360 ),
361 'ai_meta' => array(
362 'entity' => 'tag',
363 'reference_type' => 'dynamic',
364 'taxonomy' => 'product_tag',
365 'value_format' => 'slug',
366 'semantic_group' => 'product_exclusion',
367 'abstraction_level' => 2,
368 'toggled_by' => 'exclude_tags_toggle',
369 'usage_hint' => 'Use when excluding products by tag. Dynamic: future products added to the tag are automatically excluded.',
370 ),
371
372 ),
373
374 array(
375 'id' => 'exclude_brands_toggle',
376 'type' => 'switcher',
377 'title' => esc_html__( 'Exclude Brands', 'merchant' ),
378 'desc' => esc_html__( 'Exclude specific brands from this campaign.', 'merchant' ),
379 'default' => 0,
380 'conditions' => array(
381 'relation' => 'AND',
382 'terms' => array(
383 array(
384 'field' => 'rules_to_apply',
385 'operator' => 'in',
386 'value' => array( 'all', 'categories', 'tags' ),
387 ),
388 ),
389 ),
390 'ai_meta' => array(
391 'toggle_for' => 'excluded_brands',
392 'semantic_group' => 'product_exclusion',
393 'usage_hint' => 'Enable this toggle before setting excluded_brands. Only available when rules_to_display is all, categories, or tags.',
394 ),
395
396 ),
397
398 array(
399 'id' => 'excluded_brands',
400 'type' => 'select_ajax',
401 'title' => esc_html__( 'Excluded Brands List', 'merchant' ),
402 'source' => 'options',
403 'multiple' => true,
404 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
405 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
406 'desc' => esc_html__( 'Select the product brands that the spending goal will not apply to.', 'merchant' ),
407 'conditions' => array(
408 'relation' => 'AND',
409 'terms' => array(
410 array(
411 'field' => 'rules_to_apply',
412 'operator' => 'in',
413 'value' => array( 'all', 'categories', 'tags' ),
414 ),
415 array(
416 'field' => 'exclude_brands_toggle',
417 'operator' => '===',
418 'value' => true,
419 ),
420 ),
421 ),
422 'ai_meta' => array(
423 'entity' => 'brand',
424 'reference_type' => 'dynamic',
425 'taxonomy' => 'product_brand',
426 'value_format' => 'slug',
427 'semantic_group' => 'product_exclusion',
428 'abstraction_level' => 4,
429 'toggled_by' => 'exclude_brands_toggle',
430 'usage_hint' => 'Use when excluding products by brand. Dynamic: future products added to the brand are automatically excluded.',
431 ),
432
433 ),
434
435 'amount' => array(
436 'id' => 'amount',
437 'title' => esc_html__( 'Spending goal', 'merchant' ),
438 'type' => 'number',
439 'step' => 0.01,
440 'append' => function_exists( 'get_woocommerce_currency_symbol' ) ? get_woocommerce_currency() : esc_html__( 'USD', 'merchant' ),
441 'default' => 100,
442 'ai_meta' => array(
443 'semantic_group' => 'offer_rules',
444 'usage_hint' => 'Minimum cart spend to trigger the free gift.',
445 ),
446
447 ),
448
449 array(
450 'id' => 'product',
451 'type' => 'products_selector',
452 'title' => esc_html__( 'Product rewarded as a gift', 'merchant' ),
453 'multiple' => false,
454 'allowed_types' => array( 'simple', 'variable', 'variation' ),
455 'ai_meta' => array(
456 'entity' => 'product',
457 'reference_type' => 'static',
458 'value_format' => 'product_id',
459 'semantic_group' => 'offer_rules',
460 'abstraction_level' => 1,
461 'usage_hint' => 'The product given as a free gift when the spending threshold is met.',
462 ),
463
464 ),
465
466 array(
467 'id' => 'exclude_coupon',
468 'type' => 'switcher',
469 'title' => esc_html__( 'Exclude coupons', 'merchant' ),
470 'desc' => esc_html__( 'Coupon codes will not be applicable on top of this offer.', 'merchant' ),
471 'default' => 1,
472 'ai_meta' => array(
473 'usage_hint' => 'When enabled, coupon codes cannot be stacked on top of this campaign.',
474 ),
475
476 ),
477
478 array(
479 'id' => 'user_condition',
480 'type' => 'select',
481 'title' => esc_html__( 'User Condition', 'merchant' ),
482 'options' => array(
483 'all' => esc_html__( 'All Users', 'merchant' ),
484 'customers' => esc_html__( 'Selected Users', 'merchant' ),
485 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
486 ),
487 'default' => 'all',
488 'ai_meta' => array(
489 'semantic_group' => 'user_targeting',
490 'usage_hint' => 'Controls which users see this campaign. Set this BEFORE setting user_condition_roles or user_condition_users.',
491 ),
492
493 ),
494
495 array(
496 'id' => 'user_condition_roles',
497 'type' => 'select_ajax',
498 'title' => esc_html__( 'User Roles', 'merchant' ),
499 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
500 'source' => 'options',
501 'multiple' => true,
502 'classes' => array( 'flex-grow' ),
503 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
504 'condition' => array( 'user_condition', '==', 'roles' ),
505 'ai_meta' => array(
506 'entity' => 'role',
507 'reference_type' => 'dynamic',
508 'value_format' => 'role_slug',
509 'semantic_group' => 'user_targeting',
510 'abstraction_level' => 2,
511 'usage_hint' => 'Use when targeting users by role. Dynamic: future users assigned the role are included. Requires user_condition=roles.',
512 ),
513
514 ),
515
516 array(
517 'id' => 'user_condition_users',
518 'type' => 'select_ajax',
519 'title' => esc_html__( 'Users', 'merchant' ),
520 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
521 'source' => 'user',
522 'multiple' => true,
523 'classes' => array( 'flex-grow' ),
524 'condition' => array( 'user_condition', '==', 'customers' ),
525 'ai_meta' => array(
526 'entity' => 'user',
527 'reference_type' => 'static',
528 'value_format' => 'user_id',
529 'semantic_group' => 'user_targeting',
530 'abstraction_level' => 1,
531 'usage_hint' => 'Use when targeting specific individual users. Static: only selected users, not future users. Requires user_condition=customers.',
532 ),
533
534 ),
535
536 array(
537 'id' => 'user_exclusion_enabled',
538 'type' => 'switcher',
539 'title' => esc_html__( 'Exclusion List', 'merchant' ),
540 'desc' => esc_html__( 'Select the users that will not show the offer.', 'merchant' ),
541 'default' => 0,
542 'conditions' => array(
543 'relation' => 'AND',
544 'terms' => array(
545 array(
546 'field' => 'user_condition',
547 'operator' => 'in',
548 'value' => array( 'all', 'roles' ),
549 ),
550 ),
551 ),
552 'ai_meta' => array(
553 'toggle_for' => 'exclude_roles',
554 'semantic_group' => 'user_exclusion',
555 'usage_hint' => 'Enable this toggle before setting exclude_roles or exclude_users. Gates both user exclusion fields.',
556 ),
557
558 ),
559
560 array(
561 'id' => 'exclude_roles',
562 'type' => 'select_ajax',
563 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
564 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
565 'source' => 'options',
566 'multiple' => true,
567 'classes' => array( 'flex-grow' ),
568 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
569 'conditions' => array(
570 'relation' => 'AND',
571 'terms' => array(
572 array(
573 'field' => 'user_condition',
574 'operator' => 'in',
575 'value' => array( 'all' ),
576 ),
577 array(
578 'field' => 'user_exclusion_enabled',
579 'operator' => '===',
580 'value' => true,
581 ),
582 ),
583 ),
584 'ai_meta' => array(
585 'entity' => 'role',
586 'reference_type' => 'dynamic',
587 'value_format' => 'role_slug',
588 'semantic_group' => 'user_exclusion',
589 'abstraction_level' => 2,
590 'toggled_by' => 'user_exclusion_enabled',
591 'usage_hint' => 'Use when excluding users by role. Dynamic: future users assigned the role are excluded.',
592 ),
593
594 ),
595
596 array(
597 'id' => 'exclude_users',
598 'type' => 'select_ajax',
599 'title' => esc_html__( 'Exclude Users', 'merchant' ),
600 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
601 'source' => 'user',
602 'multiple' => true,
603 'classes' => array( 'flex-grow' ),
604 'conditions' => array(
605 'relation' => 'AND',
606 'terms' => array(
607 array(
608 'field' => 'user_condition',
609 'operator' => 'in',
610 'value' => array( 'all', 'roles' ),
611 ),
612 array(
613 'field' => 'user_exclusion_enabled',
614 'operator' => '===',
615 'value' => true,
616 ),
617 ),
618 ),
619 'ai_meta' => array(
620 'entity' => 'user',
621 'reference_type' => 'static',
622 'value_format' => 'user_id',
623 'semantic_group' => 'user_exclusion',
624 'abstraction_level' => 1,
625 'toggled_by' => 'user_exclusion_enabled',
626 'usage_hint' => 'Use ONLY for excluding specific individual users. For role-level exclusions, prefer exclude_roles.',
627 ),
628
629 ),
630
631 array(
632 'id' => 'spending_goal_target',
633 'type' => 'content',
634 'title' => esc_html__( 'Spending goal target', 'merchant' ),
635 'content' => '',
636 'desc' => esc_html__( 'Configure the text for the gift offer across five phases. Personalize the text at each phase to maximize conversions.', 'merchant' ),
637 ),
638
639 array(
640 'id' => 'spending_text_0',
641 'type' => 'text',
642 'title' => esc_html__( 'At 0%', 'merchant' ),
643 'default' => sprintf(
644 /* Translators: 1. goal amount */
645 esc_html__( 'Spend %1$s to receive this gift!', 'merchant' ),
646 '{goalAmount}' // existing one is {amount}
647 ),
648 ),
649
650 array(
651 'id' => 'spending_text_1_to_99',
652 'type' => 'text',
653 'title' => esc_html__( 'Between 1 - 99%', 'merchant' ),
654 'default' => sprintf(
655 /* Translators: 1. more amount */
656 esc_html__( 'Spend %1$s more to receive this gift!', 'merchant' ),
657 '{amountMore}'
658 ),
659 ),
660
661 array(
662 'id' => 'spending_text_100',
663 'type' => 'text',
664 'title' => esc_html__( 'At 100%', 'merchant' ),
665 'default' => esc_html__( 'Congratulations! You are eligible to receive a free gift.', 'merchant' ),
666 ),
667
668 array(
669 'id' => 'text_before_claim',
670 'type' => 'text',
671 'title' => esc_html__( 'Reminder to claim the gift on the cart page', 'merchant' ),
672 'default' => esc_html__( 'Don\'t forget to claim your free gift before checking out!', 'merchant' ),
673 ),
674
675 array(
676 'id' => 'text_after_claim',
677 'type' => 'text',
678 'title' => esc_html__( 'Gift claimed message', 'merchant' ),
679 'default' => esc_html__( 'Your free gift has been added to your cart. Thank you for shopping with us!', 'merchant' ),
680 ),
681 ),
682 ),
683 'coupon' => array(
684 'title' => esc_html__( 'Coupon Based', 'merchant' ),
685 'title-field' => 'offer-title', // text field ID to use as title for the layout
686 'fields' => array(
687 array(
688 'id' => 'offer-title',
689 'type' => 'text',
690 'title' => esc_html__( 'Offer name', 'merchant' ),
691 'default' => esc_html__( 'Campaign', 'merchant' ),
692 ),
693 array(
694 'id' => 'product',
695 'type' => 'products_selector',
696 'title' => esc_html__( 'Product', 'merchant' ),
697 'multiple' => false,
698 'desc' => esc_html__( 'Select the product that the coupon will apply to.', 'merchant' ),
699 'allowed_types' => array( 'simple', 'variable', 'variation' ),
700 ),
701 'coupon' => array(
702 'id' => 'coupon',
703 'title' => esc_html__( 'Select the coupon that will apply to this offer.', 'merchant' ),
704 'type' => 'wc_coupons',
705 ),
706 array(
707 'id' => 'coupon_campaign_info',
708 'type' => 'info_block',
709 'description' => esc_html__( 'The offer won’t appear in the Free-Gifts widget unless the associated coupon is entered.', 'merchant' ),
710 ),
711 ),
712 ),
713 ),
714 'default' => array(
715 array(
716 'layout' => 'spending',
717 'min_quantity' => 2,
718 'discount' => 10,
719 'discount_type' => 'percentage_discount',
720 ),
721 ),
722 ),
723 ),
724 ),
725 array(
726 'module' => Merchant_Free_Gifts::MODULE_ID,
727 'title' => esc_html__( 'Cart Settings', 'merchant' ),
728 'fields' => array(
729 array(
730 'id' => 'gift_claim_method',
731 'type' => 'select',
732 'title' => esc_html__( 'Gift claim method', 'merchant' ),
733 'desc' => esc_html__( 'Select how customers receive free gifts. ‘Manual’ requires customers to click a claim button, while ‘Automatic’ adds the gift to their cart once they meet the spending threshold.', 'merchant' ),
734 'options' => array(
735 'manual' => esc_html__( 'Manual', 'merchant' ),
736 'automatic' => esc_html__( 'Automatic', 'merchant' ),
737 ),
738 'default' => 'manual',
739 'ai_meta' => array(
740 'usage_hint' => 'Controls how customers claim the free gift: auto-add or manual.',
741 ),
742
743 ),
744
745 array(
746 'id' => 'total_type',
747 'type' => 'select',
748 'title' => esc_html__( 'Gift based on spending type', 'merchant' ),
749 'desc' => esc_html__( 'Select the basis for the gift spending goal: ‘Cart Subtotal’ (excludes tax and shipping) or ‘Cart Total’ (includes tax and shipping).', 'merchant' ),
750 'options' => array(
751 'subtotal' => esc_html__( 'Cart subtotal', 'merchant' ),
752 'total' => esc_html__( 'Cart total', 'merchant' ),
753 ),
754 'default' => 'subtotal',
755 'ai_meta' => array(
756 'usage_hint' => 'Whether to calculate spending threshold based on subtotal or total (including tax/shipping).',
757 ),
758
759 ),
760
761 array(
762 'id' => 'free_text',
763 'type' => 'text',
764 'title' => esc_html__( 'Gift price label', 'merchant' ),
765 'default' => esc_html__( 'Free', 'merchant' ),
766 ),
767
768 array(
769 'id' => 'cart_title_text',
770 'type' => 'text',
771 'title' => esc_html__( 'Cart item title text', 'merchant' ),
772 'default' => esc_html__( 'Free Gift', 'merchant' ),
773 'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ),
774 ),
775
776 array(
777 'id' => 'cart_description_text',
778 'type' => 'text',
779 'title' => esc_html__( 'Cart item description text', 'merchant' ),
780 'default' => esc_html__( 'This item was added as a free gift', 'merchant' ),
781 'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ),
782 ),
783
784 array(
785 'id' => 'tiered_free_gifts',
786 'type' => 'switcher',
787 'title' => esc_html__( 'Tiered free gifts', 'merchant' ),
788 'desc' => esc_html__( 'Customers can claim one free gift per order. Selecting a new gift automatically replaces any previously chosen gift.', 'merchant' ),
789 'default' => 0,
790 ),
791 ),
792 ),
793 array(
794 'title' => esc_html__( 'Gift Widget', 'merchant' ),
795 'module' => Merchant_Free_Gifts::MODULE_ID,
796 'fields' => array(
797 array(
798 'id' => 'icon',
799 'type' => 'choices',
800 'title' => esc_html__( 'Widget icon', 'merchant' ),
801 'options' => array(
802 'gifts-icon-1' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-1.svg',
803 'gifts-icon-2' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-2.svg',
804 'gifts-icon-3' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-3.svg',
805 'gifts-icon-4' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-4.svg',
806 'gifts-icon-5' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-5.svg',
807 ),
808 'default' => 'gifts-icon-1',
809 ),
810
811 array(
812 'id' => 'position',
813 'type' => 'select',
814 'title' => esc_html__( 'Position', 'merchant' ),
815 'options' => array(
816 'top_right' => esc_html__( 'Top Right', 'merchant' ),
817 'top_left' => esc_html__( 'Top Left', 'merchant' ),
818 'bottom_right' => esc_html__( 'Bottom Right', 'merchant' ),
819 'bottom_left' => esc_html__( 'Bottom Left', 'merchant' ),
820 ),
821 'default' => 'top_right',
822 ),
823
824 array(
825 'id' => 'distance',
826 'type' => 'range',
827 'title' => esc_html__( 'Distance', 'merchant' ),
828 'min' => 0,
829 'max' => 999,
830 'step' => 1,
831 'unit' => 'px',
832 'default' => 150,
833 ),
834
835 array(
836 'id' => 'display_homepage',
837 'type' => 'checkbox',
838 'title' => esc_html__( 'Show on pages', 'merchant' ),
839 'label' => esc_html__( 'Homepage', 'merchant' ),
840 'default' => 1,
841 ),
842
843 array(
844 'id' => 'display_shop',
845 'type' => 'checkbox',
846 'label' => esc_html__( 'Shop page', 'merchant' ),
847 'default' => 1,
848 ),
849
850 array(
851 'id' => 'display_product',
852 'type' => 'checkbox',
853 'label' => esc_html__( 'Product page', 'merchant' ),
854 'default' => 1,
855 ),
856
857 array(
858 'id' => 'display_cart',
859 'type' => 'checkbox',
860 'label' => esc_html__( 'Cart page', 'merchant' ),
861 'default' => 1,
862 ),
863 ),
864 ),
865 array(
866 'module' => Merchant_Free_Gifts::MODULE_ID,
867 'title' => esc_html__( 'Look and Feel', 'merchant' ),
868 'fields' => array(
869 array(
870 'id' => 'count_bg_color',
871 'type' => 'color',
872 'title' => esc_html__( 'Count background color', 'merchant' ),
873 'default' => '#000',
874 ),
875
876 array(
877 'id' => 'count_text_color',
878 'type' => 'color',
879 'title' => esc_html__( 'Count text color', 'merchant' ),
880 'default' => '#fff',
881 ),
882
883 array(
884 'id' => 'button_bg_color',
885 'type' => 'color',
886 'title' => esc_html__( 'Gift button background color', 'merchant' ),
887 'default' => '#362e94',
888 ),
889
890 array(
891 'id' => 'button_hover_bg_color',
892 'type' => 'color',
893 'title' => esc_html__( 'Gift button Hover background color', 'merchant' ),
894 'default' => '#7167e1',
895 ),
896
897 array(
898 'id' => 'button_text_color',
899 'type' => 'color',
900 'title' => esc_html__( 'Gift button Icon color', 'merchant' ),
901 'default' => '#fff',
902 ),
903
904 array(
905 'id' => 'content_width',
906 'type' => 'range',
907 'title' => esc_html__( 'Content width', 'merchant' ),
908 'min' => 0,
909 'max' => 600,
910 'step' => 1,
911 'unit' => 'px',
912 'default' => 300,
913 ),
914
915 array(
916 'id' => 'mobile_width',
917 'type' => 'checkbox',
918 'label' => esc_html__( 'Mobile width', 'merchant' ),
919 'default' => 0,
920 ),
921
922 array(
923 'id' => 'content_width_mobile',
924 'type' => 'range',
925 'title' => esc_html__( 'Content width', 'merchant' ),
926 'min' => 0,
927 'max' => 600,
928 'step' => 1,
929 'unit' => 'px',
930 'default' => 300,
931 'condition' => array( 'mobile_width', '==', '1' ),
932 ),
933
934 array(
935 'id' => 'content_bg_color',
936 'type' => 'color',
937 'title' => esc_html__( 'Content background color', 'merchant' ),
938 'default' => '#fff',
939 ),
940
941 array(
942 'id' => 'label_bg_color',
943 'type' => 'color',
944 'title' => esc_html__( 'Label background color', 'merchant' ),
945 'default' => '#f5f5f5',
946 ),
947
948 array(
949 'id' => 'label_text_color',
950 'type' => 'color',
951 'title' => esc_html__( 'Label text color', 'merchant' ),
952 'default' => '#212121',
953 ),
954
955 array(
956 'id' => 'product_text_color',
957 'type' => 'color',
958 'title' => esc_html__( 'Product text color', 'merchant' ),
959 'default' => '#212121',
960 ),
961
962 array(
963 'id' => 'product_text_hover_color',
964 'type' => 'color',
965 'title' => esc_html__( 'Product hover text color', 'merchant' ),
966 'default' => '#757575',
967 ),
968
969 array(
970 'id' => 'product_price_text_color',
971 'type' => 'color',
972 'title' => esc_html__( 'Product price text color', 'merchant' ),
973 'default' => '#999999',
974 ),
975
976 array(
977 'id' => 'free_text_color',
978 'type' => 'color',
979 'title' => esc_html__( 'Gift price label color', 'merchant' ),
980 'default' => '#212121',
981 ),
982 ),
983 ),
984 );
985