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 / complementary-products / 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/complementary-products/admin/options.php

1,016 lines 36.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Add To Cart Text — 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__( 'Complementary Offers', 'merchant' ),
19 'module' => Merchant_Complementary_Products::MODULE_ID,
20 'fields' => array(
21 array(
22 'id' => 'offers',
23 'type' => 'flexible_content',
24 'button_label' => esc_html__( 'Add New Complementary Offer', 'merchant' ),
25 'style' => Merchant_Complementary_Products::MODULE_ID . '-style default',
26 'sorting' => true,
27 'duplicate' => true,
28 'accordion' => true,
29 'layouts' => array(
30 'offer-details' => array(
31 'title' => esc_html__( 'Create Discount Tiers', '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__( 'Campaign', 'merchant' ),
54 ),
55 array(
56 'id' => 'rules_to_display',
57 'type' => 'select',
58 'title' => esc_html__( 'Trigger', 'merchant' ),
59 'options' => array(
60 'all' => esc_html__( 'All Products', 'merchant' ),
61 'products' => 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' => 'products',
67 'ai_meta' => array(
68 'semantic_group' => 'product_targeting',
69 'usage_hint' => 'Controls which products this campaign applies to. Set this BEFORE setting product_id, category_slugs, tag_slugs, or brand_slugs — those fields are conditional on this value.',
70 ),
71
72 ),
73 array(
74 'id' => 'product_to_display',
75 'type' => 'products_selector',
76 'title' => esc_html__( 'Select a product', 'merchant' ),
77 'multiple' => false,
78 'desc' => esc_html__( 'Select the product you want to pair with the complementary items.', 'merchant' ),
79 'condition' => array( 'rules_to_display', '==', 'products' ),
80 'ai_meta' => array(
81 'entity' => 'product',
82 'reference_type' => 'static',
83 'value_format' => 'product_id',
84 'semantic_group' => 'product_targeting',
85 'abstraction_level' => 1,
86 'usage_hint' => 'Use when targeting specific individual products by name or SKU. Requires rules_to_display=products.',
87 ),
88
89 ),
90 array(
91 'id' => 'category_slugs',
92 'type' => 'select_ajax',
93 'title' => esc_html__( 'Categories', 'merchant' ),
94 'source' => 'options',
95 'multiple' => true,
96 'options' => Merchant_Admin_Options::get_category_select2_choices(),
97 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
98 'desc' => esc_html__( 'Select the product categories that will show the complementary items.', 'merchant' ),
99 'condition' => array( 'rules_to_display', '==', 'categories' ),
100 'ai_meta' => array(
101 'entity' => 'category',
102 'reference_type' => 'dynamic',
103 'taxonomy' => 'product_cat',
104 'value_format' => 'slug',
105 'semantic_group' => 'product_targeting',
106 'abstraction_level' => 3,
107 'usage_hint' => 'Use when targeting products by category. Dynamic: future products added to the category are included. Requires rules_to_display=categories.',
108 ),
109
110 ),
111
112 array(
113 'id' => 'tag_slugs',
114 'type' => 'select_ajax',
115 'title' => esc_html__( 'Tags', 'merchant' ),
116 'source' => 'options',
117 'multiple' => true,
118 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
119 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
120 'desc' => esc_html__( 'Select the product tags that will show the complementary items.', 'merchant' ),
121 'condition' => array( 'rules_to_display', '==', 'tags' ),
122 'ai_meta' => array(
123 'entity' => 'tag',
124 'reference_type' => 'dynamic',
125 'taxonomy' => 'product_tag',
126 'value_format' => 'slug',
127 'semantic_group' => 'product_targeting',
128 'abstraction_level' => 2,
129 'usage_hint' => 'Use when targeting products by tag. Dynamic: future products added to the tag are included. Requires rules_to_display=tags.',
130 ),
131
132 ),
133 array(
134 'id' => 'brand_slugs',
135 'type' => 'select_ajax',
136 'title' => esc_html__( 'Brands', 'merchant' ),
137 'source' => 'options',
138 'multiple' => true,
139 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
140 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
141 'desc' => esc_html__( 'Select the product brands that will show the complementary items.', 'merchant' ),
142 'condition' => array( 'rules_to_display', '==', 'brands' ),
143 'ai_meta' => array(
144 'entity' => 'brand',
145 'reference_type' => 'dynamic',
146 'taxonomy' => 'product_brand',
147 'value_format' => 'slug',
148 'semantic_group' => 'product_targeting',
149 'abstraction_level' => 4,
150 'usage_hint' => 'Use when targeting products by brand. Dynamic: future products added to the brand are included. Requires rules_to_display=brands.',
151 ),
152
153 ),
154
155 array(
156 'id' => 'exclude_products_toggle',
157 'type' => 'switcher',
158 'title' => esc_html__( 'Exclude products', 'merchant' ),
159 'default' => 0,
160 'conditions' => array(
161 'relation' => 'AND',
162 'terms' => array(
163 array(
164 'field' => 'rules_to_display',
165 'operator' => 'in',
166 'value' => array( 'all', 'categories', 'tags', 'brands' ),
167 ),
168 ),
169 ),
170 'ai_meta' => array(
171 'toggle_for' => 'excluded_products',
172 'semantic_group' => 'product_exclusion',
173 'usage_hint' => 'Enable this toggle before setting excluded_products. Only available when rules_to_display is all, categories, tags, or brands.',
174 ),
175
176 ),
177
178 array(
179 'id' => 'excluded_products',
180 'type' => 'products_selector',
181 'title' => esc_html__( 'Excluded Products List', 'merchant' ),
182 'multiple' => true,
183 'desc' => esc_html__( 'Exclude products from this campaign.', 'merchant' ),
184 'conditions' => array(
185 'relation' => 'AND',
186 'terms' => array(
187 array(
188 'field' => 'rules_to_display',
189 'operator' => 'in',
190 'value' => array( 'all', 'categories', 'tags', 'brands' ),
191 ),
192 array(
193 'field' => 'exclude_products_toggle',
194 'operator' => '===',
195 'value' => true,
196 ),
197 ),
198 ),
199 'ai_meta' => array(
200 'entity' => 'product',
201 'reference_type' => 'static',
202 'value_format' => 'product_id',
203 'semantic_group' => 'product_exclusion',
204 'abstraction_level' => 1,
205 'toggled_by' => 'exclude_products_toggle',
206 'usage_hint' => 'Use ONLY for excluding specific individual products. For brand/category/tag exclusions, prefer excluded_brands/excluded_categories/excluded_tags.',
207 ),
208
209 ),
210
211 array(
212 'id' => 'exclude_categories_toggle',
213 'type' => 'switcher',
214 'title' => esc_html__( 'Exclude categories', 'merchant' ),
215 'default' => 0,
216 'conditions' => array(
217 'relation' => 'AND',
218 'terms' => array(
219 array(
220 'field' => 'rules_to_display',
221 'operator' => 'in',
222 'value' => array( 'all', 'tags', 'brands' ),
223 ),
224 ),
225 ),
226 'ai_meta' => array(
227 'toggle_for' => 'excluded_categories',
228 'semantic_group' => 'product_exclusion',
229 'usage_hint' => 'Enable this toggle before setting excluded_categories. Only available when rules_to_display is all, tags, or brands.',
230 ),
231
232 ),
233
234 array(
235 'id' => 'excluded_categories',
236 'type' => 'select_ajax',
237 'title' => esc_html__( 'Excluded Categories List', 'merchant' ),
238 'source' => 'options',
239 'multiple' => true,
240 'options' => Merchant_Admin_Options::get_category_select2_choices(),
241 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
242 'desc' => esc_html__( 'Exclude categories from this campaign.', 'merchant' ),
243 'conditions' => array(
244 'relation' => 'AND',
245 'terms' => array(
246 array(
247 'field' => 'rules_to_display',
248 'operator' => 'in',
249 'value' => array( 'all', 'tags', 'brands' ),
250 ),
251 array(
252 'field' => 'exclude_categories_toggle',
253 'operator' => '===',
254 'value' => true,
255 ),
256 ),
257 ),
258 'ai_meta' => array(
259 'entity' => 'category',
260 'reference_type' => 'dynamic',
261 'taxonomy' => 'product_cat',
262 'value_format' => 'slug',
263 'semantic_group' => 'product_exclusion',
264 'abstraction_level' => 3,
265 'toggled_by' => 'exclude_categories_toggle',
266 'usage_hint' => 'Use when excluding products by category. Dynamic: future products added to the category are automatically excluded.',
267 ),
268
269 ),
270
271 array(
272 'id' => 'exclude_tags_toggle',
273 'type' => 'switcher',
274 'title' => esc_html__( 'Exclude product tags', 'merchant' ),
275 'default' => 0,
276 'conditions' => array(
277 'relation' => 'AND',
278 'terms' => array(
279 array(
280 'field' => 'rules_to_display',
281 'operator' => 'in',
282 'value' => array( 'all', 'categories', 'brands' ),
283 ),
284 ),
285 ),
286 'ai_meta' => array(
287 'toggle_for' => 'excluded_tags',
288 'semantic_group' => 'product_exclusion',
289 'usage_hint' => 'Enable this toggle before setting excluded_tags. Only available when rules_to_display is all, categories, or brands.',
290 ),
291
292 ),
293
294 array(
295 'id' => 'excluded_tags',
296 'type' => 'select_ajax',
297 'title' => esc_html__( 'Excluded Tags List', 'merchant' ),
298 'source' => 'options',
299 'multiple' => true,
300 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
301 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
302 'desc' => esc_html__( 'Exclude tags from this campaign.', 'merchant' ),
303 'conditions' => array(
304 'relation' => 'AND',
305 'terms' => array(
306 array(
307 'field' => 'rules_to_display',
308 'operator' => 'in',
309 'value' => array( 'all', 'categories', 'brands' ),
310 ),
311 array(
312 'field' => 'exclude_tags_toggle',
313 'operator' => '===',
314 'value' => true,
315 ),
316 ),
317 ),
318 'ai_meta' => array(
319 'entity' => 'tag',
320 'reference_type' => 'dynamic',
321 'taxonomy' => 'product_tag',
322 'value_format' => 'slug',
323 'semantic_group' => 'product_exclusion',
324 'abstraction_level' => 2,
325 'toggled_by' => 'exclude_tags_toggle',
326 'usage_hint' => 'Use when excluding products by tag. Dynamic: future products added to the tag are automatically excluded.',
327 ),
328
329 ),
330
331 array(
332 'id' => 'exclude_brands_toggle',
333 'type' => 'switcher',
334 'title' => esc_html__( 'Exclude Brands', 'merchant' ),
335 'default' => 0,
336 'conditions' => array(
337 'relation' => 'AND',
338 'terms' => array(
339 array(
340 'field' => 'rules_to_display',
341 'operator' => 'in',
342 'value' => array( 'all', 'categories', 'tags' ),
343 ),
344 ),
345 ),
346 'ai_meta' => array(
347 'toggle_for' => 'excluded_brands',
348 'semantic_group' => 'product_exclusion',
349 'usage_hint' => 'Enable this toggle before setting excluded_brands. Only available when rules_to_display is all, categories, or tags.',
350 ),
351
352 ),
353
354 array(
355 'id' => 'excluded_brands',
356 'type' => 'select_ajax',
357 'title' => esc_html__( 'Excluded Brands List', 'merchant' ),
358 'source' => 'options',
359 'multiple' => true,
360 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
361 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
362 'desc' => esc_html__( 'Exclude brands from this campaign.', 'merchant' ),
363 'conditions' => array(
364 'relation' => 'AND',
365 'terms' => array(
366 array(
367 'field' => 'rules_to_display',
368 'operator' => 'in',
369 'value' => array( 'all', 'categories', 'tags' ),
370 ),
371 array(
372 'field' => 'exclude_brands_toggle',
373 'operator' => '===',
374 'value' => true,
375 ),
376 ),
377 ),
378 'ai_meta' => array(
379 'entity' => 'brand',
380 'reference_type' => 'dynamic',
381 'taxonomy' => 'product_brand',
382 'value_format' => 'slug',
383 'semantic_group' => 'product_exclusion',
384 'abstraction_level' => 4,
385 'toggled_by' => 'exclude_brands_toggle',
386 'usage_hint' => 'Use when excluding products by brand. Dynamic: future products added to the brand are automatically excluded.',
387 ),
388
389 ),
390
391 array(
392 'id' => 'products',
393 'title' => esc_html__( 'Complementary products', 'merchant' ),
394 'type' => 'products_selector',
395 'multiple' => true,
396 'desc' => esc_html__( 'Select the products you want to sell alongside the main product', 'merchant' ),
397 'ai_meta' => array(
398 'entity' => 'product',
399 'reference_type' => 'static',
400 'value_format' => 'product_id',
401 'semantic_group' => 'offer_rules',
402 'abstraction_level' => 1,
403 'usage_hint' => 'The complementary products to suggest alongside the trigger products.',
404 ),
405
406 ),
407 array(
408 'id' => 'enable_discount',
409 'type' => 'switcher',
410 'title' => __( 'Offer a discount on this bundle', 'merchant' ),
411 'default' => 0,
412 ),
413 array(
414 'id' => 'discount_type',
415 'type' => 'radio',
416 'title' => esc_html__( 'Discount', 'merchant' ),
417 'options' => array(
418 'percentage_discount' => esc_html__( 'Percentage', 'merchant' ),
419 'fixed_discount' => esc_html__( 'Fixed', 'merchant' ),
420 'cheapest_item_free' => esc_html__( 'Cheapest item free', 'merchant' ),
421 'free_shipping' => esc_html__( 'Free Shipping', 'merchant' ),
422 ),
423 'default' => 'percentage_discount',
424 'conditions' => array(
425 'relation' => 'AND',
426 'terms' => array(
427 array(
428 'field' => 'enable_discount',
429 'operator' => '===',
430 'value' => true,
431 ),
432 ),
433 ),
434 'ai_meta' => array(
435 'usage_hint' => 'Choose percentage_discount for relative discounts or fixed_discount for absolute amounts.',
436 ),
437
438 ),
439 array(
440 'id' => 'discount_value',
441 'type' => 'number',
442 'default' => 10,
443 'step' => 0.01,
444 'conditions' => array(
445 'relation' => 'AND',
446 'terms' => array(
447 array(
448 'field' => 'enable_discount',
449 'operator' => '===',
450 'value' => true,
451 ),
452 array(
453 'field' => 'discount_type',
454 'operator' => 'in',
455 'value' => array( 'percentage_discount', 'fixed_discount' ),
456 ),
457 ),
458 ),
459 'ai_meta' => array(
460 'semantic_group' => 'offer_rules',
461 'usage_hint' => 'The discount amount. Percentage (e.g. 10 for 10%% off) or fixed currency amount, depending on discount_type.',
462 ),
463
464 ),
465 array(
466 'id' => 'min_selection_discount',
467 'title' => esc_html__( 'Minimum product selection to trigger the discount', 'merchant' ),
468 'type' => 'number',
469 'default' => 1,
470 'step' => 1,
471 'conditions' => array(
472 'relation' => 'AND',
473 'terms' => array(
474 array(
475 'field' => 'enable_discount',
476 'operator' => '===',
477 'value' => true,
478 ),
479 ),
480 ),
481 ),
482 array(
483 'id' => 'checkboxes-state',
484 'type' => 'radio',
485 'title' => esc_html__( 'Checkboxes for each product', 'merchant' ),
486 'options' => array(
487 'auto-checked' => esc_html__( 'Auto checked', 'merchant' ),
488 'unchecked' => esc_html__( 'Unchecked', 'merchant' ),
489 ),
490 'default' => 'unchecked',
491 ),
492 array(
493 'id' => 'user_condition',
494 'type' => 'select',
495 'title' => esc_html__( 'User Condition', 'merchant' ),
496 'options' => array(
497 'all' => esc_html__( 'All Users', 'merchant' ),
498 'customers' => esc_html__( 'Selected Users', 'merchant' ),
499 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
500 ),
501 'default' => 'all',
502 'ai_meta' => array(
503 'semantic_group' => 'user_targeting',
504 'usage_hint' => 'Controls which users see this campaign. Set this BEFORE setting user_condition_roles or user_condition_users.',
505 ),
506
507 ),
508 array(
509 'id' => 'user_condition_roles',
510 'type' => 'select_ajax',
511 'title' => esc_html__( 'User Roles', 'merchant' ),
512 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
513 'source' => 'options',
514 'multiple' => true,
515 'classes' => array( 'flex-grow' ),
516 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
517 'condition' => array( 'user_condition', '==', 'roles' ),
518 'ai_meta' => array(
519 'entity' => 'role',
520 'reference_type' => 'dynamic',
521 'value_format' => 'role_slug',
522 'semantic_group' => 'user_targeting',
523 'abstraction_level' => 2,
524 'usage_hint' => 'Use when targeting users by role. Dynamic: future users assigned the role are included. Requires user_condition=roles.',
525 ),
526
527 ),
528
529 array(
530 'id' => 'user_condition_users',
531 'type' => 'select_ajax',
532 'title' => esc_html__( 'Users', 'merchant' ),
533 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
534 'source' => 'user',
535 'multiple' => true,
536 'classes' => array( 'flex-grow' ),
537 'condition' => array( 'user_condition', '==', 'customers' ),
538 'ai_meta' => array(
539 'entity' => 'user',
540 'reference_type' => 'static',
541 'value_format' => 'user_id',
542 'semantic_group' => 'user_targeting',
543 'abstraction_level' => 1,
544 'usage_hint' => 'Use when targeting specific individual users. Static: only selected users, not future users. Requires user_condition=customers.',
545 ),
546
547 ),
548
549 array(
550 'id' => 'user_exclusion_enabled',
551 'type' => 'switcher',
552 'title' => esc_html__( 'Exclusion List', 'merchant' ),
553 'desc' => esc_html__( 'Hide this offer from certain users.', 'merchant' ),
554 'default' => 0,
555 'conditions' => array(
556 'relation' => 'AND',
557 'terms' => array(
558 array(
559 'field' => 'user_condition',
560 'operator' => 'in',
561 'value' => array( 'all', 'roles' ),
562 ),
563 ),
564 ),
565 'ai_meta' => array(
566 'toggle_for' => 'exclude_roles',
567 'semantic_group' => 'user_exclusion',
568 'usage_hint' => 'Enable this toggle before setting exclude_roles or exclude_users. Gates both user exclusion fields.',
569 ),
570
571 ),
572
573 array(
574 'id' => 'exclude_roles',
575 'type' => 'select_ajax',
576 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
577 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
578 'source' => 'options',
579 'multiple' => true,
580 'classes' => array( 'flex-grow' ),
581 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
582 'conditions' => array(
583 'relation' => 'AND',
584 'terms' => array(
585 array(
586 'field' => 'user_condition',
587 'operator' => 'in',
588 'value' => array( 'all' ),
589 ),
590 array(
591 'field' => 'user_exclusion_enabled',
592 'operator' => '===',
593 'value' => true,
594 ),
595 ),
596 ),
597 'ai_meta' => array(
598 'entity' => 'role',
599 'reference_type' => 'dynamic',
600 'value_format' => 'role_slug',
601 'semantic_group' => 'user_exclusion',
602 'abstraction_level' => 2,
603 'toggled_by' => 'user_exclusion_enabled',
604 'usage_hint' => 'Use when excluding users by role. Dynamic: future users assigned the role are excluded.',
605 ),
606
607 ),
608
609 array(
610 'id' => 'exclude_users',
611 'type' => 'select_ajax',
612 'title' => esc_html__( 'Exclude Users', 'merchant' ),
613 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
614 'source' => 'user',
615 'multiple' => true,
616 'classes' => array( 'flex-grow' ),
617 'conditions' => array(
618 'relation' => 'AND',
619 'terms' => array(
620 array(
621 'field' => 'user_condition',
622 'operator' => 'in',
623 'value' => array( 'all', 'roles' ),
624 ),
625 array(
626 'field' => 'user_exclusion_enabled',
627 'operator' => '===',
628 'value' => true,
629 ),
630 ),
631 ),
632 'ai_meta' => array(
633 'entity' => 'user',
634 'reference_type' => 'static',
635 'value_format' => 'user_id',
636 'semantic_group' => 'user_exclusion',
637 'abstraction_level' => 1,
638 'toggled_by' => 'user_exclusion_enabled',
639 'usage_hint' => 'Use ONLY for excluding specific individual users. For role-level exclusions, prefer exclude_roles.',
640 ),
641
642 ),
643
644 array(
645 'id' => 'product_single_page',
646 'type' => 'fields_group',
647 'title' => esc_html__( 'Product Single Page', 'merchant' ),
648 'sub-desc' => esc_html__( 'Use these settings to control how complementary product offers appear on product pages.',
649 'merchant' ),
650 'state' => 'open',
651 'default' => 'active',
652 'accordion' => true,
653 'display_status' => true,
654 'fields' => array(
655 array(
656 'id' => 'single_product_placement',
657 'type' => 'select',
658 'title' => esc_html__( 'Placement on product page', 'merchant' ),
659 'options' => array(
660 'before-add-to-cart' => esc_html__( 'Before Add to Cart', 'merchant' ),
661 'after-summary' => esc_html__( 'After Product Summary', 'merchant' ),
662 'after-tabs' => esc_html__( 'After Product Tabs', 'merchant' ),
663 ),
664 'default' => 'before-add-to-cart',
665 ),
666
667 // text formatting settings
668 array(
669 'id' => 'offer-title',
670 'type' => 'text',
671 'title' => esc_html__( 'Offer title', 'merchant' ),
672 'default' => esc_html__( 'Campaign', 'merchant' ),
673 'desc' => esc_html__( 'Enter an optional title to show before the complementary products', 'merchant' ),
674 ),
675
676 array(
677 'id' => 'offer-description',
678 'type' => 'textarea',
679 'title' => esc_html__( 'Short description', 'merchant' ),
680 'desc' => esc_html__( 'Enter an optional description to display after the offer title.', 'merchant' ),
681 'hidden_desc' => sprintf(
682 /* Translators: %1$s: Display the discount amount */
683 __(
684 '<strong>%1$s:</strong> Display the discount, only applies to percentage or fixed-amount discounts',
685 'merchant'
686 ),
687 '{discount_amount}',
688 ),
689 ),
690 ),
691 ),
692
693 array(
694 'id' => 'cart_page',
695 'type' => 'fields_group',
696 'title' => esc_html__( 'Cart Page', 'merchant' ),
697 'default' => 'inactive',
698 'sub-desc' => esc_html__( 'Use these settings to control how complementary product offers appear on the cart page.', 'merchant' ),
699 'state' => 'closed',
700 'accordion' => true,
701 'display_status' => true,
702 'fields' => array(
703 // text formatting settings
704 array(
705 'id' => 'title',
706 'type' => 'text',
707 'title' => esc_html__( 'Campaign title', 'merchant' ),
708 'default' => esc_html__( 'Add', 'merchant' ),
709 'desc' => esc_html__( 'Add discount title', 'merchant' ),
710 'hidden_desc' => sprintf(
711 /* Translators: %1$s: Display the discount amount */
712 __(
713 '<strong>%1$s:</strong> Display the discount, only applies to percentage or fixed-amount discounts',
714 'merchant'
715 ),
716 '{discount_amount}',
717 ),
718 ),
719 array(
720 'id' => 'button_text',
721 'type' => 'text',
722 'title' => esc_html__( 'Button text', 'merchant' ),
723 'default' => esc_html__( 'Add to cart', 'merchant' ),
724 ),
725 ),
726 ),
727
728 array(
729 'id' => 'checkout_page',
730 'type' => 'fields_group',
731 'title' => esc_html__( 'Checkout Page', 'merchant' ),
732 'sub-desc' => esc_html__( 'Use these settings to control how complementary product offers appear on the checkout page.', 'merchant' ),
733 'state' => 'closed',
734 'default' => 'inactive',
735 'accordion' => true,
736 'display_status' => true,
737 'fields' => array(
738 array(
739 'id' => 'placement',
740 'type' => 'select',
741 'title' => esc_html__( 'Placement', 'merchant' ),
742 'options' => array(
743 'before_billing_details' => esc_html__( 'Before Billing Details', 'merchant' ),
744 'after_billing_details' => esc_html__( 'After Billing Details', 'merchant' ),
745 'before_order_details' => esc_html__( 'Before Order Details', 'merchant' ),
746 'before_payment_options' => esc_html__( 'Before Payment Gateways', 'merchant' ),
747 'before_order_placement_btn' => esc_html__( 'Before Order Placement Button', 'merchant' ),
748 'after_order_placement_btn' => esc_html__( 'After Order Placement Button', 'merchant' ),
749 ),
750 'default' => 'before_payment_options',
751 ),
752 array(
753 'id' => 'title',
754 'type' => 'text',
755 'title' => esc_html__( 'Offer title', 'merchant' ),
756 'default' => esc_html__( 'Recommended For You', 'merchant' ),
757 'desc' => esc_html__( 'Enter an optional title to show before the complementary products', 'merchant' ),
758 'hidden_desc' => sprintf(
759 /* Translators: %1$s: Display the discount amount */
760 __(
761 '<strong>%1$s:</strong> Display the discount, only applies to percentage or fixed-amount discounts',
762 'merchant'
763 ),
764 '{discount_amount}',
765 ),
766 ),
767 array(
768 'id' => 'offer_description',
769 'type' => 'textarea',
770 'title' => esc_html__( 'Description', 'merchant' ),
771 'desc' => esc_html__( 'Enter an optional campaign description', 'merchant' ),
772 'hidden_desc' => sprintf(
773 /* Translators: %1$s: Display the discount amount */
774 __(
775 '<strong>%1$s:</strong> Display the discount, only applies to percentage or fixed-amount discounts',
776 'merchant'
777 ),
778 '{discount_amount}',
779 ),
780 ),
781 array(
782 'id' => 'button_text',
783 'type' => 'text',
784 'title' => esc_html__( 'Button text', 'merchant' ),
785 'default' => esc_html__( 'Add To Cart', 'merchant' ),
786 ),
787 ),
788 ),
789
790 array(
791 'id' => 'thank_you_page',
792 'type' => 'fields_group',
793 'title' => esc_html__( 'Thank you Page', 'merchant' ),
794 'default' => 'inactive',
795 'sub-desc' => esc_html__( 'Use these settings to control how complementary product offers appear on the thank you page.', 'merchant' ),
796 'state' => 'closed',
797 'accordion' => true,
798 'display_status' => true,
799 'fields' => array(
800 array(
801 'id' => 'placement',
802 'type' => 'select',
803 'title' => esc_html__( 'Placement', 'merchant' ),
804 'options' => array(
805 'on_top' => esc_html__( 'On Top', 'merchant' ),
806 'before_order_details' => esc_html__( 'Before Order details', 'merchant' ),
807 'after_order_details' => esc_html__( 'After Order details', 'merchant' ),
808 ),
809 'default' => 'before_order_details',
810 ),
811 array(
812 'id' => 'title',
813 'type' => 'text',
814 'title' => esc_html__( 'Bundle title', 'merchant' ),
815 'desc' => esc_html__( 'Add discount title', 'merchant' ),
816 'default' => esc_html__( 'Last chance to get', 'merchant' ),
817 'hidden_desc' => sprintf(
818 /* Translators: %1$s: Display the discount amount */
819 __(
820 '<strong>%1$s:</strong> Display the discount, only applies to percentage or fixed-amount discounts',
821 'merchant'
822 ),
823 '{discount_amount}',
824 ),
825 ),
826
827 array(
828 'id' => 'discount_text',
829 'type' => 'text',
830 'title' => esc_html__( 'Discount text', 'merchant' ),
831 'default' => esc_html__( 'With discount', 'merchant' ),
832 'desc' => esc_html__( 'Show the discount details on the product', 'merchant' ),
833 'hidden_desc' => sprintf(
834 /* Translators: %1$s: Display the discount amount */
835 __(
836 '<strong>%1$s:</strong> Display the discount, only applies to percentage or fixed-amount discounts',
837 'merchant'
838 ),
839 '{discount_amount}',
840 ),
841 ),
842
843 array(
844 'id' => 'button_text',
845 'type' => 'text',
846 'title' => esc_html__( 'Button text', 'merchant' ),
847 'default' => esc_html__( 'Add to cart', 'merchant' ),
848 ),
849 ),
850 ),
851 ),
852 ),
853 ),
854 'default' => array(
855 array(
856 'layout' => 'offer-details',
857 'min_quantity' => 2,
858 'discount' => 10,
859 'discount_type' => 'percentage_discount',
860 ),
861 ),
862 ),
863 ),
864 ),
865 // Style
866 array(
867 'title' => esc_html__( 'Look and Feel', 'merchant' ),
868 'module' => Merchant_Complementary_Products::MODULE_ID,
869 'fields' => array(
870 array(
871 'id' => 'layout',
872 'type' => 'radio',
873 'title' => esc_html__( 'Layout', 'merchant' ),
874 'options' => array(
875 'classic' => esc_html__( 'Classic', 'merchant' ),
876 'compact' => esc_html__( 'Compact', 'merchant' ),
877 // only the copy has been changed to carousel, but the naming is the same "slider"
878 'slider' => esc_html__( 'Carousel', 'merchant' ),
879 ),
880 'default' => 'slider',
881 ),
882
883 array(
884 'id' => 'checkbox_style',
885 'type' => 'radio',
886 'title' => esc_html__( 'Checkbox style', 'merchant' ),
887 'options' => array(
888 'rounded' => esc_html__( 'Rounded', 'merchant' ),
889 'square' => esc_html__( 'Square', 'merchant' ),
890 ),
891 'default' => 'square',
892 ),
893
894 array(
895 'id' => 'checkbox_color',
896 'type' => 'color',
897 'title' => esc_html__( 'Checkbox color', 'merchant' ),
898 'default' => '#000000',
899 ),
900
901 array(
902 'id' => 'title_color',
903 'type' => 'color',
904 'title' => esc_html__( 'Title color', 'merchant' ),
905 'default' => '#000000',
906 ),
907
908 array(
909 'id' => 'description_color',
910 'type' => 'color',
911 'title' => esc_html__( 'Description color', 'merchant' ),
912 'default' => '#000000',
913 ),
914
915 array(
916 'id' => 'border_color',
917 'type' => 'color',
918 'title' => esc_html__( 'Border color', 'merchant' ),
919 'default' => '#000000',
920 ),
921
922 array(
923 'id' => 'image_border_color',
924 'type' => 'color',
925 'title' => esc_html__( 'Image border color', 'merchant' ),
926 'default' => 'rgba(0,0,0,0)',
927 ),
928
929 array(
930 'id' => 'title_heading_size',
931 'type' => 'select',
932 'title' => esc_html__( 'Title heading', 'merchant' ),
933 'options' => array(
934 'h1' => esc_html__( 'H1', 'merchant' ),
935 'h2' => esc_html__( 'H2', 'merchant' ),
936 'h3' => esc_html__( 'H3', 'merchant' ),
937 'h4' => esc_html__( 'H4', 'merchant' ),
938 'h5' => esc_html__( 'H5', 'merchant' ),
939 'h6' => esc_html__( 'H6', 'merchant' ),
940 ),
941 'default' => 'h4',
942 ),
943
944
945 array(
946 'id' => 'description_font_size',
947 'type' => 'range',
948 'title' => esc_html__( 'Description font size', 'merchant' ),
949 'min' => 0,
950 'max' => 100,
951 'step' => 1,
952 'unit' => 'px',
953 'default' => 14,
954 ),
955
956 array(
957 'id' => 'title_description_alignment',
958 'type' => 'radio',
959 'title' => esc_html__( 'Title and description alignment', 'merchant' ),
960 'options' => array(
961 'left' => esc_html__( 'Left', 'merchant' ),
962 'center' => esc_html__( 'Center', 'merchant' ),
963 'right' => esc_html__( 'Right', 'merchant' ),
964 ),
965 'default' => 'left',
966 ),
967
968 array(
969 'id' => 'border_radius',
970 'type' => 'range',
971 'title' => esc_html__( 'Border radius', 'merchant' ),
972 'min' => 0,
973 'max' => 60,
974 'step' => 1,
975 'default' => 0,
976 'unit' => 'px',
977 ),
978
979 array(
980 'id' => 'image_border_radius',
981 'type' => 'range',
982 'title' => esc_html__( 'Image border radius', 'merchant' ),
983 'min' => 0,
984 'max' => 60,
985 'step' => 1,
986 'default' => 0,
987 'unit' => 'px',
988 ),
989 ),
990 ),
991 array(
992 'module' => Merchant_Complementary_Products::MODULE_ID,
993 'title' => esc_html__( 'Use shortcode', 'merchant' ),
994 'fields' => array(
995 array(
996 'id' => 'use_shortcode',
997 'type' => 'switcher',
998 'title' => __( 'Use shortcode', 'merchant' ),
999 'default' => 0,
1000 ),
1001 array(
1002 'type' => 'info',
1003 'id' => 'shortcode_info',
1004 '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. Note that the shortcodes can only be used on single product pages.',
1005 'merchant' ),
1006 ),
1007 array(
1008 'id' => 'shortcode_text',
1009 'type' => 'text_readonly',
1010 'title' => esc_html__( 'Shortcode text', 'merchant' ),
1011 'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Complementary_Products::MODULE_ID ) . ']',
1012 'condition' => array( 'use_shortcode', '==', '1' ),
1013 ),
1014 ),
1015 ),
1016 );