PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.2.7
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.2.7
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 / frequently-bought-together / admin / options.php

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

884 lines 32.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Frequently Bought Together 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 'title' => esc_html__( 'Bundle Offers', 'merchant' ),
15 'module' => Merchant_Frequently_Bought_Together::MODULE_ID,
16 'fields' => array(
17 array(
18 'id' => 'offers',
19 'type' => 'flexible_content',
20 'button_label' => esc_html__( 'Add New Bundle', 'merchant' ),
21 'style' => Merchant_Frequently_Bought_Together::MODULE_ID . '-style default',
22 'sorting' => true,
23 'duplicate' => true,
24 'accordion' => true,
25 'layouts' => array(
26 'offer-details' => array(
27 'title' => esc_html__( 'Create Discount Tiers', 'merchant' ),
28 'title-field' => 'offer-title', // text field ID to use as title for the layout
29 'status-field' => 'campaign_status',
30 'fields' => array(
31 array(
32 'id' => 'campaign_status',
33 'type' => 'select',
34 'title' => esc_html__( 'Status', 'merchant' ),
35 'options' => array(
36 'active' => esc_html__( 'Active', 'merchant' ),
37 'inactive' => esc_html__( 'Inactive', 'merchant' ),
38 ),
39 'default' => 'active',
40 ),
41 array(
42 'id' => 'offer-title',
43 'type' => 'text',
44 'title' => esc_html__( 'Offer name', 'merchant' ),
45 'default' => esc_html__( 'Campaign', 'merchant' ),
46 ),
47 array(
48 'id' => 'rules_to_display',
49 'type' => 'select',
50 'title' => esc_html__( 'Trigger', 'merchant' ),
51 'options' => array(
52 'all' => esc_html__( 'All Products', 'merchant' ),
53 'products' => esc_html__( 'Specific Products', 'merchant' ),
54 'categories' => esc_html__( 'Specific Categories', 'merchant' ),
55 'tags' => esc_html__( 'Specific Tags', 'merchant' ),
56 'brands' => esc_html__( 'Specific Brands', 'merchant' ),
57 ),
58 'default' => 'products',
59 ),
60 array(
61 'id' => 'product_to_display',
62 'type' => 'products_selector',
63 'title' => esc_html__( 'Select a product', 'merchant' ),
64 'multiple' => false,
65 'desc' => esc_html__( 'Select the product that you want to create the bundle for.', 'merchant' ),
66 'condition' => array( 'rules_to_display', '==', 'products' ),
67 'allowed_types' => array( 'simple', 'variable' ),
68 ),
69 array(
70 'id' => 'category_slugs',
71 'type' => 'select_ajax',
72 'title' => esc_html__( 'Categories', 'merchant' ),
73 'source' => 'options',
74 'multiple' => true,
75 'options' => Merchant_Admin_Options::get_category_select2_choices(),
76 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
77 'desc' => esc_html__( 'Select the product categories that will show the offer.', 'merchant' ),
78 'condition' => array( 'rules_to_display', '==', 'categories' ),
79 ),
80
81 array(
82 'id' => 'tag_slugs',
83 'type' => 'select_ajax',
84 'title' => esc_html__( 'Tags', 'merchant' ),
85 'source' => 'options',
86 'multiple' => true,
87 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
88 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
89 'desc' => esc_html__( 'Select the product tags that will show the offer.', 'merchant' ),
90 'condition' => array( 'rules_to_display', '==', 'tags' ),
91 ),
92 array(
93 'id' => 'brand_slugs',
94 'type' => 'select_ajax',
95 'title' => esc_html__( 'Brands', 'merchant' ),
96 'source' => 'options',
97 'multiple' => true,
98 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
99 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
100 'desc' => esc_html__( 'Select the product brands that will show the offer.', 'merchant' ),
101 'condition' => array( 'rules_to_display', '==', 'brands' ),
102 ),
103
104
105
106
107 array(
108 'id' => 'exclude_products_toggle',
109 'type' => 'switcher',
110 'title' => esc_html__( 'Exclude products', 'merchant' ),
111 'default' => 0,
112 'conditions' => array(
113 'relation' => 'AND',
114 'terms' => array(
115 array(
116 'field' => 'rules_to_display',
117 'operator' => 'in',
118 'value' => array( 'all', 'categories', 'tags', 'brands' ),
119 ),
120 ),
121 ),
122 ),
123
124 array(
125 'id' => 'excluded_products',
126 'type' => 'products_selector',
127 'title' => esc_html__( 'Exclude Products', 'merchant' ),
128 'multiple' => true,
129 'desc' => esc_html__( 'Exclude products from this campaign.', 'merchant' ),
130 'conditions' => array(
131 'relation' => 'AND',
132 'terms' => array(
133 array(
134 'field' => 'rules_to_display',
135 'operator' => 'in',
136 'value' => array( 'all', 'categories', 'tags', 'brands' ),
137 ),
138 array(
139 'field' => 'exclude_products_toggle',
140 'operator' => '===',
141 'value' => true,
142 ),
143 ),
144 ),
145 ),
146
147 array(
148 'id' => 'exclude_categories_toggle',
149 'type' => 'switcher',
150 'title' => esc_html__( 'Exclude categories', 'merchant' ),
151 'default' => 0,
152 'conditions' => array(
153 'relation' => 'AND',
154 'terms' => array(
155 array(
156 'field' => 'rules_to_display',
157 'operator' => 'in',
158 'value' => array( 'all', 'tags', 'brands' ),
159 ),
160 ),
161 ),
162 ),
163
164 array(
165 'id' => 'excluded_categories',
166 'type' => 'select_ajax',
167 'title' => esc_html__( 'Excluded Categories List', 'merchant' ),
168 'source' => 'options',
169 'multiple' => true,
170 'options' => Merchant_Admin_Options::get_category_select2_choices(),
171 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
172 'desc' => esc_html__( 'Exclude categories from this campaign.', 'merchant' ),
173 'conditions' => array(
174 'relation' => 'AND',
175 'terms' => array(
176 array(
177 'field' => 'rules_to_display',
178 'operator' => 'in',
179 'value' => array( 'all', 'tags', 'brands' ),
180 ),
181 array(
182 'field' => 'exclude_categories_toggle',
183 'operator' => '===',
184 'value' => true,
185 ),
186 ),
187 ),
188 ),
189
190 array(
191 'id' => 'exclude_tags_toggle',
192 'type' => 'switcher',
193 'title' => esc_html__( 'Exclude product tags', 'merchant' ),
194 'default' => 0,
195 'conditions' => array(
196 'relation' => 'AND',
197 'terms' => array(
198 array(
199 'field' => 'rules_to_display',
200 'operator' => 'in',
201 'value' => array( 'all', 'categories', 'brands' ),
202 ),
203 ),
204 ),
205 ),
206
207 array(
208 'id' => 'excluded_tags',
209 'type' => 'select_ajax',
210 'title' => esc_html__( 'Excluded Tags List', 'merchant' ),
211 'source' => 'options',
212 'multiple' => true,
213 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
214 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
215 'desc' => esc_html__( 'Exclude tags from this campaign.', 'merchant' ),
216 'conditions' => array(
217 'relation' => 'AND',
218 'terms' => array(
219 array(
220 'field' => 'rules_to_display',
221 'operator' => 'in',
222 'value' => array( 'all', 'categories', 'brands' ),
223 ),
224 array(
225 'field' => 'exclude_tags_toggle',
226 'operator' => '===',
227 'value' => true,
228 ),
229 ),
230 ),
231 ),
232
233 array(
234 'id' => 'exclude_brands_toggle',
235 'type' => 'switcher',
236 'title' => esc_html__( 'Exclude Brands', 'merchant' ),
237 'default' => 0,
238 'conditions' => array(
239 'relation' => 'AND',
240 'terms' => array(
241 array(
242 'field' => 'rules_to_display',
243 'operator' => 'in',
244 'value' => array( 'all', 'categories', 'tags' ),
245 ),
246 ),
247 ),
248 ),
249
250 array(
251 'id' => 'excluded_brands',
252 'type' => 'select_ajax',
253 'title' => esc_html__( 'Excluded Brands List', 'merchant' ),
254 'source' => 'options',
255 'multiple' => true,
256 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
257 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
258 'desc' => esc_html__( 'Exclude brands from this campaign.', 'merchant' ),
259 'conditions' => array(
260 'relation' => 'AND',
261 'terms' => array(
262 array(
263 'field' => 'rules_to_display',
264 'operator' => 'in',
265 'value' => array( 'all', 'categories', 'tags' ),
266 ),
267 array(
268 'field' => 'exclude_brands_toggle',
269 'operator' => '===',
270 'value' => true,
271 ),
272 ),
273 ),
274 ),
275
276 array(
277 'id' => 'exclude_onsale_products_toggle',
278 'type' => 'switcher',
279 'title' => esc_html__( 'Exclude On-Sale products', 'merchant' ),
280 'default' => 0,
281 'conditions' => array(
282 'relation' => 'AND',
283 'terms' => array(
284 array(
285 'field' => 'rules_to_display',
286 'operator' => 'in',
287 'value' => array( 'all', 'categories', 'tags', 'brands' ),
288 ),
289 ),
290 ),
291 ),
292
293
294
295
296
297 array(
298 'id' => 'offer_products_based_on',
299 'type' => 'radio',
300 'title' => esc_html__( 'Offer products based on', 'merchant' ),
301 'options' => array(
302 'manual' => esc_html__( 'Manual Selection', 'merchant' ),
303 'ai' => esc_html__( 'AI Recommendations', 'merchant' ),
304 ),
305 'default' => 'manual',
306 'desc' => esc_html__( 'Choose the maximum number of products you’d like the bundle to include.', 'merchant' ),
307 ),
308 array(
309 'id' => 'ai_products_count',
310 'title' => esc_html__( 'Maximum number of offer products shown', 'merchant' ),
311 'type' => 'select',
312 'desc' => esc_html__( 'You can show a maximum of 5 offer products.', 'merchant' ),
313 'options' => array(
314 '1' => esc_html__( '2 products (Target product + 1 AI product)', 'merchant' ),
315 '2' => esc_html__( '3 products (Target product + 2 AI products)', 'merchant' ),
316 '3' => esc_html__( '4 products (Target product + 3 AI products)', 'merchant' ),
317 '4' => esc_html__( '5 products (Target product + 4 AI products)', 'merchant' ),
318 '5' => esc_html__( '6 products (Target product + 5 AI products)', 'merchant' ),
319 ),
320 'default' => '2',
321 'conditions' => array(
322 'relation' => 'AND',
323 'terms' => array(
324 array(
325 'field' => 'offer_products_based_on',
326 'operator' => '===',
327 'value' => 'ai',
328 ),
329 ),
330 ),
331 ),
332 array(
333 'id' => 'products',
334 'title' => esc_html__( 'Products to offer', 'merchant' ),
335 'type' => 'products_selector',
336 'multiple' => true,
337 'desc' => esc_html__( 'Select the products that will be included the bundle.', 'merchant' ),
338 'conditions' => array(
339 'relation' => 'AND',
340 'terms' => array(
341 array(
342 'field' => 'offer_products_based_on',
343 'operator' => '===',
344 'value' => 'manual',
345 ),
346 ),
347 ),
348 ),
349 array(
350 'id' => 'optional_offer_products',
351 'type' => 'checkbox',
352 'label' => __( 'Offer products as optional', 'merchant' ),
353 'desc' => __( 'Offer the products using checkboxes, so shoppers can choose what to buy', 'merchant' ),
354 'default' => 1,
355 ),
356 array(
357 'id' => 'external',
358 'label' => __( 'Display the offer on all products in the bundle', 'merchant' ),
359 'desc' => __( 'Show the campaign on the offered products included in the bundle to maximize visibility', 'merchant' ),
360 'type' => 'checkbox',
361 'default' => 0,
362 'conditions' => array(
363 'relation' => 'AND',
364 'terms' => array(
365 array(
366 'field' => 'offer_products_based_on',
367 'operator' => '===',
368 'value' => 'manual',
369 ),
370 array(
371 'field' => 'rules_to_display',
372 'operator' => '===',
373 'value' => 'products',
374 ),
375 ),
376 ),
377 ),
378 array(
379 'id' => 'enable_discount',
380 'type' => 'switcher',
381 'title' => __( 'Offer a discount on this bundle', 'merchant' ),
382 'default' => 0,
383 ),
384 array(
385 'id' => 'discount_type',
386 'type' => 'radio',
387 'title' => esc_html__( 'Discount', 'merchant' ),
388 'options' => array(
389 'percentage_discount' => esc_html__( 'Percentage', 'merchant' ),
390 'fixed_discount' => esc_html__( 'Fixed', 'merchant' ),
391 ),
392 'default' => 'percentage_discount',
393 'condition' => array( 'enable_discount', '==', '1' ),
394 ),
395 array(
396 'id' => 'discount_value',
397 'type' => 'number',
398 'default' => 10,
399 'step' => 0.01,
400 'condition' => array( 'enable_discount', '==', '1' ),
401 ),
402
403 array(
404 'id' => 'discount_target',
405 'type' => 'select',
406 'title' => esc_html__( 'Apply discount to', 'merchant' ),
407 'options' => array(
408 'regular' => esc_html__( 'Regular Price', 'merchant' ),
409 'sale' => esc_html__( 'Sale Price', 'merchant' ),
410 ),
411 'default' => 'sale',
412 'condition' => array( 'enable_discount', '==', '1' ),
413 ),
414
415 array(
416 'id' => 'user_condition',
417 'type' => 'select',
418 'title' => esc_html__( 'User Condition', 'merchant' ),
419 'options' => array(
420 'all' => esc_html__( 'All Users', 'merchant' ),
421 'customers' => esc_html__( 'Selected Users', 'merchant' ),
422 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
423 ),
424 'default' => 'all',
425 ),
426
427 array(
428 'id' => 'user_condition_roles',
429 'type' => 'select_ajax',
430 'title' => esc_html__( 'User Roles', 'merchant' ),
431 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
432 'source' => 'options',
433 'multiple' => true,
434 'classes' => array( 'flex-grow' ),
435 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
436 'condition' => array( 'user_condition', '==', 'roles' ),
437 ),
438
439 array(
440 'id' => 'user_condition_users',
441 'type' => 'select_ajax',
442 'title' => esc_html__( 'Users', 'merchant' ),
443 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
444 'source' => 'user',
445 'multiple' => true,
446 'classes' => array( 'flex-grow' ),
447 'condition' => array( 'user_condition', '==', 'customers' ),
448 ),
449
450 array(
451 'id' => 'user_exclusion_enabled',
452 'type' => 'switcher',
453 'title' => esc_html__( 'Exclusion List', 'merchant' ),
454 'desc' => esc_html__( 'Exclude specific users from seeing the offer', 'merchant' ),
455 'default' => 0,
456 'conditions' => array(
457 'relation' => 'AND',
458 'terms' => array(
459 array(
460 'field' => 'user_condition',
461 'operator' => 'in',
462 'value' => array( 'all', 'roles' ),
463 ),
464 ),
465 ),
466 ),
467
468 array(
469 'id' => 'exclude_roles',
470 'type' => 'select_ajax',
471 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
472 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
473 'source' => 'options',
474 'multiple' => true,
475 'classes' => array( 'flex-grow' ),
476 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
477 'conditions' => array(
478 'relation' => 'AND',
479 'terms' => array(
480 array(
481 'field' => 'user_condition',
482 'operator' => 'in',
483 'value' => array( 'all' ),
484 ),
485 array(
486 'field' => 'user_exclusion_enabled',
487 'operator' => '===',
488 'value' => true,
489 ),
490 ),
491 ),
492 ),
493
494 array(
495 'id' => 'exclude_users',
496 'type' => 'select_ajax',
497 'title' => esc_html__( 'Exclude Users', 'merchant' ),
498 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
499 'source' => 'user',
500 'multiple' => true,
501 'classes' => array( 'flex-grow' ),
502 'conditions' => array(
503 'relation' => 'AND',
504 'terms' => array(
505 array(
506 'field' => 'user_condition',
507 'operator' => 'in',
508 'value' => array( 'all', 'roles' ),
509 ),
510 array(
511 'field' => 'user_exclusion_enabled',
512 'operator' => '===',
513 'value' => true,
514 ),
515 ),
516 ),
517 ),
518
519 array(
520 'id' => 'product_single_page',
521 'type' => 'fields_group',
522 'title' => esc_html__( 'Product Single Page', 'merchant' ),
523 'sub-desc' => esc_html__( 'Use these settings to control how frequently bought together offers appear on product pages.',
524 'merchant' ),
525 'state' => 'open',
526 'default' => 'active',
527 'accordion' => true,
528 'display_status' => true,
529 'fields' => array(
530 array(
531 'id' => 'single_product_placement',
532 'type' => 'hook_select',
533 'title' => esc_html__( 'Placement on product page', 'merchant' ),
534 'options' => array(
535 'after-summary' => esc_html__( 'After Product Summary', 'merchant' ),
536 'after-tabs' => esc_html__( 'After Product Tabs', 'merchant' ),
537 'bottom' => esc_html__( 'At the Bottom', 'merchant' ),
538 ),
539 'min' => - 999,
540 'max' => 999,
541 'step' => 1,
542 'unit' => '',
543 'order' => true,
544 'default' => array(
545 'hook_name' => 'after-summary',
546 'hook_priority' => 10,
547 ),
548 ),
549
550 // text formatting settings
551 array(
552 'id' => 'title',
553 'type' => 'text',
554 'title' => esc_html__( 'Bundle title', 'merchant' ),
555 'default' => esc_html__( 'Frequently Bought Together', 'merchant' ),
556 ),
557
558 array(
559 'id' => 'price_label',
560 'type' => 'text',
561 'title' => esc_html__( 'Price label', 'merchant' ),
562 'default' => esc_html__( 'Bundle price', 'merchant' ),
563 ),
564
565 array(
566 'id' => 'price_label_single_product',
567 'type' => 'text',
568 'title' => esc_html__( 'Price label for one selected product', 'merchant' ),
569 'default' => esc_html__( 'Product price', 'merchant' ),
570 'desc' => esc_html__( 'Price label when only one product selected', 'merchant' ),
571 ),
572
573 array(
574 'id' => 'save_label',
575 'type' => 'text',
576 'title' => esc_html__( 'You save label', 'merchant' ),
577 'default' => esc_html__( 'You save: {amount}', 'merchant' ),
578 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
579 'hidden_desc' => sprintf(
580 /* Translators: %1$s: Discount amount */
581 __(
582 '<strong>%1$s:</strong> to show discount amount',
583 'merchant'
584 ),
585 '{amount}'
586 ),
587 ),
588
589 array(
590 'id' => 'no_variation_selected_text',
591 'type' => 'text',
592 'title' => esc_html__( 'No variation selected text', 'merchant' ),
593 'default' => esc_html__( 'Please select an option to see your savings.', 'merchant' ),
594 ),
595
596 array(
597 'id' => 'no_variation_selected_text_has_no_discount',
598 'type' => 'text',
599 'title' => esc_html__( 'No variation selected text (no discount)', 'merchant' ),
600 'desc' => esc_html__( 'This text will be displayed when the bundle has no discount and includes a variable product.', 'merchant' ),
601 'default' => esc_html__( 'Please select an option to see the total price.', 'merchant' ),
602 ),
603
604 array(
605 'id' => 'button_text',
606 'type' => 'text',
607 'title' => esc_html__( 'Button text', 'merchant' ),
608 'default' => esc_html__( 'Add to cart', 'merchant' ),
609 ),
610
611 // style settings
612 array(
613 'id' => 'plus_bg_color',
614 'type' => 'color',
615 'title' => esc_html__( 'Plus sign background color', 'merchant' ),
616 'default' => '#212121',
617 ),
618
619 array(
620 'id' => 'plus_text_color',
621 'type' => 'color',
622 'title' => esc_html__( 'Plus sign text color', 'merchant' ),
623 'default' => '#fff',
624 ),
625
626 array(
627 'id' => 'bundle_border_color',
628 'type' => 'color',
629 'title' => esc_html__( 'Bundle border color', 'merchant' ),
630 'default' => '#f9f9f9',
631 ),
632
633 array(
634 'id' => 'bundle_border_radius',
635 'type' => 'range',
636 'title' => esc_html__( 'Bundle border radius', 'merchant' ),
637 'min' => 0,
638 'max' => 100,
639 'step' => 1,
640 'unit' => 'px',
641 'default' => 5,
642 ),
643 ),
644 ),
645
646 array(
647 'id' => 'cart_page',
648 'type' => 'fields_group',
649 'title' => esc_html__( 'Cart Page', 'merchant' ),
650 'default' => 'inactive',
651 'sub-desc' => esc_html__( 'Use these settings to control how frequently bought together offers appear on the cart page.', 'merchant' ),
652 'state' => 'closed',
653 'accordion' => true,
654 'display_status' => true,
655 'fields' => array(
656 // text formatting settings
657 array(
658 'id' => 'title',
659 'type' => 'text',
660 'title' => esc_html__( 'Bundle title', 'merchant' ),
661 'default' => esc_html__( 'Add', 'merchant' ),
662 ),
663
664 // array(
665 // 'id' => 'price_label',
666 // 'type' => 'text',
667 // 'title' => esc_html__( 'Price label', 'merchant' ),
668 // 'default' => esc_html__( 'Bundle price', 'merchant' ),
669 // ),
670
671 array(
672 'id' => 'save_label',
673 'type' => 'text',
674 'title' => esc_html__( 'And save label', 'merchant' ),
675 'default' => esc_html__( 'and save: {amount}', 'merchant' ),
676 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
677 'hidden_desc' => sprintf(
678 /* Translators: %1$s: Discount amount */
679 __(
680 '<strong>%1$s:</strong> to show discount amount',
681 'merchant'
682 ),
683 '{amount}'
684 ),
685 ),
686
687 // array(
688 // 'id' => 'no_variation_selected_text',
689 // 'type' => 'text',
690 // 'title' => esc_html__( 'No variation selected text', 'merchant' ),
691 // 'default' => esc_html__( 'Please select an option to see your savings.', 'merchant' ),
692 // ),
693 //
694 // array(
695 // 'id' => 'no_variation_selected_text_has_no_discount',
696 // 'type' => 'text',
697 // 'title' => esc_html__( 'No variation selected text (no discount)', 'merchant' ),
698 // 'desc' => esc_html__( 'This text will be displayed when the bundle has no discount and includes a variable product.', 'merchant' ),
699 // 'default' => esc_html__( 'Please select an option to see the total price.', 'merchant' ),
700 // ),
701
702 array(
703 'id' => 'button_text',
704 'type' => 'text',
705 'title' => esc_html__( 'Button text', 'merchant' ),
706 'default' => esc_html__( 'Add to cart', 'merchant' ),
707 ),
708 ),
709 ),
710 array(
711 'id' => 'checkout_page',
712 'type' => 'fields_group',
713 'title' => esc_html__( 'Checkout Page', 'merchant' ),
714 'sub-desc' => esc_html__( 'Use these settings to control how Frequently bought together offers appear on the checkout page.', 'merchant' ),
715 'state' => 'closed',
716 'default' => 'inactive',
717 'accordion' => true,
718 'display_status' => true,
719 'fields' => array(
720 array(
721 'id' => 'placement',
722 'type' => 'select',
723 'title' => esc_html__( 'Placement', 'merchant' ),
724 'options' => array(
725 'before_billing_details' => esc_html__( 'Before Billing Details', 'merchant' ),
726 'after_billing_details' => esc_html__( 'After Billing Details', 'merchant' ),
727 'before_order_details' => esc_html__( 'Before Order Details', 'merchant' ),
728 'before_payment_options' => esc_html__( 'Before Payment Gateways', 'merchant' ),
729 'before_order_placement_btn' => esc_html__( 'Before Order Placement Button', 'merchant' ),
730 'after_order_placement_btn' => esc_html__( 'After Order Placement Button', 'merchant' ),
731 ),
732 'default' => 'before_payment_options',
733 ),
734 array(
735 'id' => 'title',
736 'type' => 'text',
737 'title' => esc_html__( 'Offer title', 'merchant' ),
738 'default' => esc_html__( 'Bundle and Save!', 'merchant' ),
739 ),
740 array(
741 'id' => 'discount_text',
742 'type' => 'text',
743 'title' => esc_html__( 'Discount text', 'merchant' ),
744 'default' => esc_html__( 'Add to get {discount} off all items in your bundle ({fbt_products}).', 'merchant' ),
745 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
746 'hidden_desc' => sprintf(
747 /* Translators: %1$s: Discount amount, %2$s: FBT offer product names */
748 __(
749 '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show the product names in the offer',
750 'merchant'
751 ),
752 '{discount}',
753 '{fbt_products}'
754 ),
755 ),
756 array(
757 'id' => 'button_text',
758 'type' => 'text',
759 'title' => esc_html__( 'Button text', 'merchant' ),
760 'default' => esc_html__( 'Add To Cart', 'merchant' ),
761 ),
762 ),
763 ),
764 array(
765 'id' => 'thank_you_page',
766 'type' => 'fields_group',
767 'title' => esc_html__( 'Thank you Page', 'merchant' ),
768 'default' => 'inactive',
769 'sub-desc' => esc_html__( 'Use these settings to control how frequently bought together offers appear on the thank you page.', 'merchant' ),
770 'state' => 'closed',
771 'accordion' => true,
772 'display_status' => true,
773 'fields' => array(
774 array(
775 'id' => 'title',
776 'type' => 'text',
777 'title' => esc_html__( 'Bundle title', 'merchant' ),
778 'default' => esc_html__( 'Last chance to get {discount} off your bundle!', 'merchant' ),
779 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
780 'hidden_desc' => sprintf(
781 /* Translators: %1$s: Discount amount */
782 __(
783 '<strong>%1$s:</strong> to show discount amount',
784 'merchant'
785 ),
786 '{discount}'
787 ),
788 ),
789
790 array(
791 'id' => 'placement',
792 'type' => 'select',
793 'title' => esc_html__( 'Placement', 'merchant' ),
794 'options' => array(
795 'on_top' => esc_html__( 'On Top', 'merchant' ),
796 'before_order_details' => esc_html__( 'Before Order details', 'merchant' ),
797 'after_order_details' => esc_html__( 'After Order details', 'merchant' ),
798 ),
799 'default' => 'before_order_details',
800 ),
801
802 array(
803 'id' => 'discount_text',
804 'type' => 'text',
805 'title' => esc_html__( 'Discount text', 'merchant' ),
806 'default' => esc_html__( 'Add now to complete your bundle ({fbt_products}) and save', 'merchant' ),
807 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
808 'hidden_desc' => sprintf(
809 /* Translators: %1$s: Discount amount */
810 __(
811 '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show the product names in the offer',
812 'merchant'
813 ),
814 '{discount}',
815 '{fbt_products}'
816 ),
817 ),
818 array(
819 'id' => 'bonus_tip_text',
820 'type' => 'textarea',
821 'title' => esc_html__( 'Bonus tip text', 'merchant' ),
822 'default' => esc_html__( 'Note: When you click ‘Add to Cart’, the item will be added to your cart and you’ll be taken to the cart page where you’ll see that a bundle discount has been applied to it. This is shown under ‘Your Savings’, and reflects a {discount} discount based on the original prices of the {fbt_products}. You can then proceed to checkout as usual. ',
823 'merchant' ),
824 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
825 'hidden_desc' => sprintf(
826 /* Translators: %1$s: Discount amount */
827 __(
828 '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show the product names in the offer',
829 'merchant'
830 ),
831 '{discount}',
832 '{fbt_products}'
833 ),
834 ),
835 array(
836 'id' => 'button_text',
837 'type' => 'text',
838 'title' => esc_html__( 'Button text', 'merchant' ),
839 'default' => esc_html__( 'Add to cart', 'merchant' ),
840 ),
841 ),
842 ),
843 ),
844 ),
845 ),
846 'default' => array(
847 array(
848 'layout' => 'offer-details',
849 'min_quantity' => 2,
850 'discount' => 10,
851 'discount_type' => 'percentage_discount',
852 ),
853 ),
854 ),
855 ),
856 ) );
857
858 // Shortcode
859 $merchant_module_id = Merchant_Frequently_Bought_Together::MODULE_ID;
860 Merchant_Admin_Options::create( array(
861 'module' => $merchant_module_id,
862 'title' => esc_html__( 'Use shortcode', 'merchant' ),
863 'fields' => array(
864 array(
865 'id' => 'use_shortcode',
866 'type' => 'switcher',
867 'title' => __( 'Use shortcode', 'merchant' ),
868 'default' => 0,
869 ),
870 array(
871 'type' => 'info',
872 'id' => 'shortcode_info',
873 '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.',
874 'merchant' ),
875 ),
876 array(
877 'id' => 'shortcode_text',
878 'type' => 'text_readonly',
879 'title' => esc_html__( 'Shortcode text', 'merchant' ),
880 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']',
881 'condition' => array( 'use_shortcode', '==', '1' ),
882 ),
883 ),
884 ) );