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

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

925 lines 33.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Volume Discounts 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__( 'Offers', 'merchant' ),
15 'module' => Merchant_Volume_Discounts::MODULE_ID,
16 'fields' => array(
17 array(
18 'id' => 'offers',
19 'type' => 'flexible_content',
20 'button_label' => esc_html__( 'Add New Offer', 'merchant' ),
21 'style' => Merchant_Volume_Discounts::MODULE_ID . '-style default',
22 'sorting' => true,
23 'accordion' => true,
24 'duplicate' => 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__( 'Offered product(s)', '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' => 'include_all_cart_products',
62 'type' => 'switcher',
63 'title' => esc_html__( 'Include all cart products', 'merchant' ),
64 'desc' => esc_html__( 'Apply the discount based on the total quantity of products added to the cart, rather than requiring a specific quantity of each individual product.', 'merchant' ),
65 'default' => false,
66 'condition' => array( 'rules_to_display', '==', 'all' ),
67 ),
68 array(
69 'id' => 'product_id',
70 'type' => 'products_selector',
71 //'title' => esc_html__( 'Select product', 'merchant' ),
72 'multiple' => true,
73 'desc' => esc_html__( 'Select the product that the customer will get a discount on when they purchase the minimum required quantity.',
74 'merchant' ),
75 'allowed_types' => array( 'simple', 'variable' ),
76 'condition' => array( 'rules_to_display', '==', 'products' ),
77 ),
78 array(
79 'id' => 'category_slugs',
80 'type' => 'select_ajax',
81 'title' => esc_html__( 'Categories', 'merchant' ),
82 'source' => 'options',
83 'multiple' => true,
84 'options' => Merchant_Admin_Options::get_category_select2_choices(),
85 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
86 'desc' => esc_html__( 'Select the product categories that will show the offer.', 'merchant' ),
87 'condition' => array( 'rules_to_display', '==', 'categories' ),
88 ),
89 array(
90 'id' => 'include_all_category_products',
91 'type' => 'switcher',
92 'title' => esc_html__( 'Include all category products', 'merchant' ),
93 'desc' => esc_html__( 'Apply the discount based on the total quantity of products within the same category added to the cart, rather than requiring a specific quantity of each individual product.', 'merchant' ),
94 'default' => false,
95 'condition' => array( 'rules_to_display', '==', 'categories' ),
96 ),
97 array(
98 'id' => 'include_all_products_info',
99 'type' => 'info',
100 'content' => esc_html__( 'When configuring offer priorities, consider the order in which they are applied. Typically, more general offers should be prioritized higher to ensure consistent discount application. You can control the priority by sorting the offers—offers listed at the top have the highest priority. However, note that this setup will not work on the thank you page.',
101 'merchant' ),
102 'conditions' => array(
103 'relation' => 'OR', // AND/OR, If not provided, only first term will be considered
104 'terms' => array(
105 array(
106 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
107 'terms' => array(
108 array(
109 'field' => 'rules_to_display', // field ID
110 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
111 'value' => 'categories', // can be a single value or an array of string/number/int
112 ),
113 array(
114 'field' => 'include_all_category_products', // field ID
115 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
116 'value' => true, // can be a single value or an array of string/number/int
117 ),
118 ),
119 ),
120 array(
121 'relation' => 'AND', // AND/OR, If not provided, only first term will be considered
122 'terms' => array(
123 array(
124 'field' => 'rules_to_display', // field ID
125 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
126 'value' => 'all', // can be a single value or an array of string/number/int
127 ),
128 array(
129 'field' => 'include_all_cart_products', // field ID
130 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
131 'value' => true, // can be a single value or an array of string/number/int
132 ),
133 ),
134 ),
135 ),
136 ),
137 ),
138 array(
139 'id' => 'tag_slugs',
140 'type' => 'select_ajax',
141 'title' => esc_html__( 'Tags', 'merchant' ),
142 'source' => 'options',
143 'multiple' => true,
144 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
145 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
146 'desc' => esc_html__( 'Select the product tags that will show the offer.', 'merchant' ),
147 'condition' => array( 'rules_to_display', '==', 'tags' ),
148 ),
149 array(
150 'id' => 'brand_slugs',
151 'type' => 'select_ajax',
152 'title' => esc_html__( 'Brands', 'merchant' ),
153 'source' => 'options',
154 'multiple' => true,
155 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
156 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
157 'desc' => esc_html__( 'Select the product brands that will show the offer.', 'merchant' ),
158 'condition' => array( 'rules_to_display', '==', 'brands' ),
159 ),
160
161 array(
162 'id' => 'exclude_products_toggle',
163 'type' => 'switcher',
164 'title' => esc_html__( 'Exclude products', 'merchant' ),
165 'default' => 0,
166 'conditions' => array(
167 'relation' => 'AND',
168 'terms' => array(
169 array(
170 'field' => 'rules_to_display',
171 'operator' => 'in',
172 'value' => array( 'all', 'categories', 'tags', 'brands' ),
173 ),
174 ),
175 ),
176 ),
177
178 array(
179 'id' => 'excluded_products',
180 'type' => 'products_selector',
181 'title' => esc_html__( 'Exclude Products', '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 ),
200
201 array(
202 'id' => 'exclude_categories_toggle',
203 'type' => 'switcher',
204 'title' => esc_html__( 'Exclude categories', 'merchant' ),
205 'default' => 0,
206 'conditions' => array(
207 'relation' => 'AND',
208 'terms' => array(
209 array(
210 'field' => 'rules_to_display',
211 'operator' => 'in',
212 'value' => array( 'all', 'tags', 'brands' ),
213 ),
214 ),
215 ),
216 ),
217
218 array(
219 'id' => 'excluded_categories',
220 'type' => 'select_ajax',
221 'title' => esc_html__( 'Excluded Categories List', 'merchant' ),
222 'source' => 'options',
223 'multiple' => true,
224 'options' => Merchant_Admin_Options::get_category_select2_choices(),
225 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
226 'desc' => esc_html__( 'Exclude categories from this campaign.', 'merchant' ),
227 'conditions' => array(
228 'relation' => 'AND',
229 'terms' => array(
230 array(
231 'field' => 'rules_to_display',
232 'operator' => 'in',
233 'value' => array( 'all', 'tags', 'brands' ),
234 ),
235 array(
236 'field' => 'exclude_categories_toggle',
237 'operator' => '===',
238 'value' => true,
239 ),
240 ),
241 ),
242 ),
243
244 array(
245 'id' => 'exclude_tags_toggle',
246 'type' => 'switcher',
247 'title' => esc_html__( 'Exclude product tags', 'merchant' ),
248 'default' => 0,
249 'conditions' => array(
250 'relation' => 'AND',
251 'terms' => array(
252 array(
253 'field' => 'rules_to_display',
254 'operator' => 'in',
255 'value' => array( 'all', 'categories', 'brands' ),
256 ),
257 ),
258 ),
259 ),
260
261 array(
262 'id' => 'excluded_tags',
263 'type' => 'select_ajax',
264 'title' => esc_html__( 'Excluded Tags List', 'merchant' ),
265 'source' => 'options',
266 'multiple' => true,
267 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
268 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
269 'desc' => esc_html__( 'Exclude tags from this campaign.', 'merchant' ),
270 'conditions' => array(
271 'relation' => 'AND',
272 'terms' => array(
273 array(
274 'field' => 'rules_to_display',
275 'operator' => 'in',
276 'value' => array( 'all', 'categories', 'brands' ),
277 ),
278 array(
279 'field' => 'exclude_tags_toggle',
280 'operator' => '===',
281 'value' => true,
282 ),
283 ),
284 ),
285 ),
286
287 array(
288 'id' => 'exclude_brands_toggle',
289 'type' => 'switcher',
290 'title' => esc_html__( 'Exclude brands', 'merchant' ),
291 'default' => 0,
292 'conditions' => array(
293 'relation' => 'AND',
294 'terms' => array(
295 array(
296 'field' => 'rules_to_display',
297 'operator' => 'in',
298 'value' => array( 'all', 'categories', 'tags' ),
299 ),
300 ),
301 ),
302 ),
303
304 array(
305 'id' => 'excluded_brands',
306 'type' => 'select_ajax',
307 'title' => esc_html__( 'Excluded Brands List', 'merchant' ),
308 'source' => 'options',
309 'multiple' => true,
310 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
311 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
312 'desc' => esc_html__( 'Exclude brands from this campaign.', 'merchant' ),
313 'conditions' => array(
314 'relation' => 'AND',
315 'terms' => array(
316 array(
317 'field' => 'rules_to_display',
318 'operator' => 'in',
319 'value' => array( 'all', 'categories', 'tags' ),
320 ),
321 array(
322 'field' => 'exclude_brands_toggle',
323 'operator' => '===',
324 'value' => true,
325 ),
326 ),
327 ),
328 ),
329
330 array(
331 'id' => 'exclude_onsale_products_toggle',
332 'type' => 'switcher',
333 'title' => esc_html__( 'Exclude On-Sale products', 'merchant' ),
334 'default' => 0,
335 'conditions' => array(
336 'relation' => 'AND',
337 'terms' => array(
338 array(
339 'field' => 'rules_to_display',
340 'operator' => 'in',
341 'value' => array( 'all', 'categories', 'tags', 'brands' ),
342 ),
343 ),
344 ),
345 ),
346
347 array(
348 'id' => 'quantity',
349 'type' => 'number',
350 'title' => esc_html__( 'Quantity', 'merchant' ),
351 'min' => 1,
352 'default' => 2,
353 ),
354
355 array(
356 'id' => 'discount_type',
357 'type' => 'radio',
358 'title' => esc_html__( 'Discount', 'merchant' ),
359 'options' => array(
360 'percentage_discount' => esc_html__( 'Percentage', 'merchant' ),
361 'fixed_discount' => esc_html__( 'Fixed', 'merchant' ),
362 ),
363 'default' => 'percentage_discount',
364 ),
365 array(
366 'id' => 'discount',
367 'type' => 'number',
368 'step' => 0.01,
369 'default' => 10,
370 ),
371
372 array(
373 'id' => 'discount_target',
374 'type' => 'select',
375 'title' => esc_html__( 'Apply discount to', 'merchant' ),
376 'options' => array(
377 'regular' => esc_html__( 'Regular Price', 'merchant' ),
378 'sale' => esc_html__( 'Sale Price', 'merchant' ),
379 ),
380 'default' => 'sale',
381 ),
382
383 array(
384 'id' => 'exclude_coupon',
385 'type' => 'switcher',
386 'title' => esc_html__( 'Exclude coupons', 'merchant' ),
387 'desc' => esc_html__( 'Coupon codes will not be applicable on top of this offer campaign.', 'merchant' ),
388 'default' => false,
389 ),
390
391 array(
392 'id' => 'user_condition',
393 'type' => 'select',
394 'title' => esc_html__( 'User Condition', 'merchant' ),
395 'options' => array(
396 'all' => esc_html__( 'All Users', 'merchant' ),
397 'customers' => esc_html__( 'Selected Users', 'merchant' ),
398 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
399 ),
400 'default' => 'all',
401 ),
402
403 array(
404 'id' => 'user_condition_roles',
405 'type' => 'select_ajax',
406 'title' => esc_html__( 'User Roles', 'merchant' ),
407 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
408 'source' => 'options',
409 'multiple' => true,
410 'classes' => array( 'flex-grow' ),
411 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
412 'condition' => array( 'user_condition', '==', 'roles' ),
413 ),
414
415 array(
416 'id' => 'user_condition_users',
417 'type' => 'select_ajax',
418 'title' => esc_html__( 'Users', 'merchant' ),
419 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
420 'source' => 'user',
421 'multiple' => true,
422 'classes' => array( 'flex-grow' ),
423 'condition' => array( 'user_condition', '==', 'customers' ),
424 ),
425
426 array(
427 'id' => 'user_exclusion_enabled',
428 'type' => 'switcher',
429 'title' => esc_html__( 'Exclusion List', 'merchant' ),
430 'desc' => esc_html__( 'Select the users that will not show the offer.', 'merchant' ),
431 'default' => 0,
432 'conditions' => array(
433 'relation' => 'AND',
434 'terms' => array(
435 array(
436 'field' => 'user_condition',
437 'operator' => 'in',
438 'value' => array( 'all', 'roles' ),
439 ),
440 ),
441 ),
442 ),
443
444 array(
445 'id' => 'exclude_roles',
446 'type' => 'select_ajax',
447 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
448 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
449 'source' => 'options',
450 'multiple' => true,
451 'classes' => array( 'flex-grow' ),
452 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
453 'conditions' => array(
454 'relation' => 'AND',
455 'terms' => array(
456 array(
457 'field' => 'user_condition',
458 'operator' => 'in',
459 'value' => array( 'all' ),
460 ),
461 array(
462 'field' => 'user_exclusion_enabled',
463 'operator' => '===',
464 'value' => true,
465 ),
466 ),
467 ),
468 ),
469
470 array(
471 'id' => 'exclude_users',
472 'type' => 'select_ajax',
473 'title' => esc_html__( 'Exclude Users', 'merchant' ),
474 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
475 'source' => 'user',
476 'multiple' => true,
477 'classes' => array( 'flex-grow' ),
478 'conditions' => array(
479 'relation' => 'AND',
480 'terms' => array(
481 array(
482 'field' => 'user_condition',
483 'operator' => 'in',
484 'value' => array( 'all', 'roles' ),
485 ),
486 array(
487 'field' => 'user_exclusion_enabled',
488 'operator' => '===',
489 'value' => true,
490 ),
491 ),
492 ),
493 ),
494
495 array(
496 'id' => 'product_single_page',
497 'type' => 'fields_group',
498 'title' => esc_html__( 'Product Single Page', 'merchant' ),
499 'sub-desc' => esc_html__( 'Use these settings to control how bulk discount offers appear on product pages.', 'merchant' ),
500 'state' => 'open',
501 'accordion' => true,
502 'display_status' => true,
503 'default' => 'active',
504 'fields' => array(
505 array(
506 'id' => 'single_product_placement',
507 'type' => 'radio',
508 'title' => esc_html__( 'Placement on product page', 'merchant' ),
509 'options' => array(
510 'before-cart-form' => esc_html__( 'Before add to cart', 'merchant' ),
511 'after-cart-form' => esc_html__( 'After add to cart', 'merchant' ),
512 ),
513 'default' => 'before-cart-form',
514 ),
515
516 // text formatting
517 array(
518 'id' => 'table_title',
519 'type' => 'text',
520 'title' => esc_html__( 'Offer title', 'merchant' ),
521 'default' => __( 'Buy more, save more!', 'merchant' ),
522 ),
523
524 // `hidden_desc` depends on `desc`
525 array(
526 'id' => 'save_label',
527 'type' => 'text',
528 'title' => esc_html__( 'Save label', 'merchant' ),
529 'default' => esc_html__( 'Save {amount}', 'merchant' ),
530 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
531 'hidden_desc' => sprintf(
532 /* Translators: %1$s: Discount amount, %2$s: Discount percentage */
533 __( '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show discount percentage', 'merchant' ),
534 '{amount}',
535 '{percent}'
536 ),
537 ),
538
539 array(
540 'id' => 'buy_text',
541 'type' => 'text',
542 'title' => esc_html__( 'Tier format text', 'merchant' ),
543 'default' => esc_html__( 'Buy {quantity}, get {discount} off each', 'merchant' ),
544 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
545 'hidden_desc' => sprintf(
546 /* Translators: %1$s: Discount percentage, %2$s: Quantity, %3$s: Discount amount */
547 __( '<strong>%1$s:</strong> to show discount percentage<br><strong>%2$s:</strong> to show the number of items needed to buy to get the discount<br><strong>%3$s:</strong> to show discount amount on each item',
548 'merchant' ),
549 '{percent}',
550 '{quantity}',
551 '{discount}'
552 ),
553 ),
554
555 array(
556 'id' => 'item_text',
557 'type' => 'text',
558 'title' => esc_html__( 'Item text', 'merchant' ),
559 'default' => esc_html__( 'Per item:', 'merchant' ),
560 ),
561
562 array(
563 'id' => 'total_text',
564 'type' => 'text',
565 'title' => esc_html__( 'Total text', 'merchant' ),
566 'default' => esc_html__( 'Total price:', 'merchant' ),
567 ),
568
569 array(
570 'id' => 'cart_title_text',
571 'type' => 'text',
572 'title' => esc_html__( 'Cart item discount title', 'merchant' ),
573 'default' => esc_html__( 'Discount', 'merchant' ),
574 'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ),
575 ),
576
577 array(
578 'id' => 'cart_description_text',
579 'type' => 'text',
580 'title' => esc_html__( 'Cart item discount description', 'merchant' ),
581 'default' => esc_html__( 'A discount of {amount} has been applied.', 'merchant' ),
582 'desc' => __( 'This is displayed on the cart page. You can use these codes in the content.', 'merchant' ),
583 'hidden_desc' => sprintf(
584 /* Translators: %1$s: Discount amount, %2$s: Discount percentage */
585 __( '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show discount percentage', 'merchant' ),
586 '{amount}',
587 '{percent}'
588 ),
589 ),
590
591 // style settings
592 array(
593 'id' => 'title_font_size',
594 'type' => 'range',
595 'title' => esc_html__( 'Title font size', 'merchant' ),
596 'min' => 0,
597 'max' => 100,
598 'step' => 1,
599 'unit' => 'px',
600 'default' => 16,
601 ),
602
603 array(
604 'id' => 'title_font_weight',
605 'type' => 'select',
606 'title' => esc_html__( 'Title font weight', 'merchant' ),
607 'options' => array(
608 'lighter' => esc_html__( 'Light', 'merchant' ),
609 'normal' => esc_html__( 'Normal', 'merchant' ),
610 'bold' => esc_html__( 'Bold', 'merchant' ),
611 ),
612 'default' => 'normal',
613 ),
614
615 array(
616 'id' => 'title_text_color',
617 'type' => 'color',
618 'title' => esc_html__( 'Title text color', 'merchant' ),
619 'default' => '#212121',
620 ),
621
622 array(
623 'id' => 'title_text_color_hover',
624 'type' => 'color',
625 'title' => esc_html__( 'Title text color hover', 'merchant' ),
626 'default' => '#212121',
627 ),
628
629 array(
630 'id' => 'table_item_bg_color',
631 'type' => 'color',
632 'title' => esc_html__( 'Background color', 'merchant' ),
633 'default' => '#fcf0f1',
634 ),
635
636 array(
637 'id' => 'table_item_bg_color_hover',
638 'type' => 'color',
639 'title' => esc_html__( 'Background color hover', 'merchant' ),
640 'default' => '#fcf0f1',
641 ),
642
643 array(
644 'id' => 'table_item_border_color',
645 'type' => 'color',
646 'title' => esc_html__( 'Border color', 'merchant' ),
647 'default' => '#d83b3b',
648 ),
649
650 array(
651 'id' => 'table_item_border_color_hover',
652 'type' => 'color',
653 'title' => esc_html__( 'Border color hover', 'merchant' ),
654 'default' => '#d83b3b',
655 ),
656
657 array(
658 'id' => 'table_item_text_color',
659 'type' => 'color',
660 'title' => esc_html__( 'Text color', 'merchant' ),
661 'default' => '#3c434a',
662 ),
663
664 array(
665 'id' => 'table_item_text_color_hover',
666 'type' => 'color',
667 'title' => esc_html__( 'Text color hover', 'merchant' ),
668 'default' => '#3c434a',
669 ),
670
671 array(
672 'id' => 'table_label_bg_color',
673 'type' => 'color',
674 'title' => esc_html__( 'Label background color', 'merchant' ),
675 'default' => '#d83b3b',
676 ),
677
678 array(
679 'id' => 'table_label_text_color',
680 'type' => 'color',
681 'title' => esc_html__( 'Label text color', 'merchant' ),
682 'default' => '#ffffff',
683 ),
684 ),
685 ),
686 array(
687 'id' => 'cart_page',
688 'type' => 'fields_group',
689 'title' => esc_html__( 'Cart Page', 'merchant' ),
690 'sub-desc' => esc_html__( 'Use these settings to control how bulk discount offers appear on the cart page.', 'merchant' ),
691 'state' => 'closed',
692 'accordion' => true,
693 'display_status' => true,
694 'default' => 'inactive',
695 'fields' => array(
696 // Text Formatting Settings
697 array(
698 'id' => 'title',
699 'type' => 'text',
700 'title' => esc_html__( 'Offer title', 'merchant' ),
701 'default' => esc_html__( 'Add {quantity} more to get a {discount} discount off each', 'merchant' ),
702 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
703 'hidden_desc' => sprintf(
704 /* Translators: %1$s: offer quantity, %2$s: discount amount */
705 __(
706 '<strong>%1$s:</strong> to show offer quantity<br><strong>%2$s:</strong> to show discount amount',
707 'merchant'
708 ),
709 '{quantity}',
710 '{discount}'
711 ),
712 ),
713
714 array(
715 'id' => 'button_text',
716 'type' => 'text',
717 'title' => esc_html__( 'Button text', 'merchant' ),
718 'default' => esc_html__( 'Add To Cart', 'merchant' ),
719 ),
720 ),
721 ),
722 array(
723 'id' => 'checkout_page',
724 'type' => 'fields_group',
725 'title' => esc_html__( 'Checkout Page', 'merchant' ),
726 'sub-desc' => esc_html__( 'Use these settings to control how bulk discount offers appear on the checkout page.', 'merchant' ),
727 'state' => 'closed',
728 'default' => 'inactive',
729 'accordion' => true,
730 'display_status' => true,
731 'fields' => array(
732 array(
733 'id' => 'placement',
734 'type' => 'select',
735 'title' => esc_html__( 'Placement', 'merchant' ),
736 'options' => array(
737 'before_billing_details' => esc_html__( 'Before Billing Details', 'merchant' ),
738 'after_billing_details' => esc_html__( 'After Billing Details', 'merchant' ),
739 'before_order_details' => esc_html__( 'Before Order Details', 'merchant' ),
740 'before_payment_options' => esc_html__( 'Before Payment Gateways', 'merchant' ),
741 'before_order_placement_btn' => esc_html__( 'Before Order Placement Button', 'merchant' ),
742 'after_order_placement_btn' => esc_html__( 'After Order Placement Button', 'merchant' ),
743 ),
744 'default' => 'before_billing_details',
745 ),
746 array(
747 'id' => 'title',
748 'type' => 'text',
749 'title' => esc_html__( 'Offer title', 'merchant' ),
750 'default' => esc_html__( 'Add {quantity} more to get {discount} off', 'merchant' ),
751 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
752 'hidden_desc' => sprintf(
753 /* Translators: %1$s: offer quantity, %2$s: discount amount */
754 __(
755 '<strong>%1$s:</strong> to show offer quantity<br><strong>%2$s:</strong> to show discount amount',
756 'merchant'
757 ),
758 '{quantity}',
759 '{discount}'
760 ),
761 ),
762 array(
763 'id' => 'discount_text',
764 'type' => 'text',
765 'title' => esc_html__( 'Discount text', 'merchant' ),
766 'default' => esc_html__( '{product_price}', 'merchant' ),
767 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
768 'hidden_desc' => sprintf(
769 /* Translators: %1$s: product price */
770 __(
771 '<strong>%1$s:</strong> to show product price<br><strong>%2$s:</strong> to show offer discount amount',
772 'merchant'
773 ),
774 '{product_price}',
775 '{discount}'
776 ),
777 ),
778 array(
779 'id' => 'button_text',
780 'type' => 'text',
781 'title' => esc_html__( 'Button text', 'merchant' ),
782 'default' => esc_html__( 'Add To Cart', 'merchant' ),
783 ),
784 ),
785 ),
786 array(
787 'id' => 'thank_you_page',
788 'type' => 'fields_group',
789 'title' => esc_html__( 'Thank You Page', 'merchant' ),
790 'sub-desc' => esc_html__( 'Use these settings to control how bulk discount offers appear on the thank you page.', 'merchant' ),
791 'state' => 'closed',
792 'accordion' => true,
793 'display_status' => true,
794 'default' => 'inactive',
795 'fields' => array(
796 // Text Formatting Settings
797 array(
798 'id' => 'title',
799 'type' => 'text',
800 'title' => esc_html__( 'Offer title', 'merchant' ),
801 'default' => esc_html__( 'Add {quantity} more to get {discount} off', 'merchant' ),
802 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
803 'hidden_desc' => sprintf(
804 /* Translators: %1$s: quantity, %2$s: post purchase discount, %3$s: In Stock, %4$s: Total quantity */
805 __(
806 '<strong>%1$s:</strong> to show product quantity<br><strong>%2$s:</strong> to show the discount amount',
807 'merchant'
808 ),
809 '{quantity}',
810 '{discount}'
811 ),
812 ),
813
814 array(
815 'id' => 'placement',
816 'type' => 'select',
817 'title' => esc_html__( 'Placement', 'merchant' ),
818 'options' => array(
819 'on_top' => esc_html__( 'On Top', 'merchant' ),
820 'before_order_details' => esc_html__( 'Before Order details', 'merchant' ),
821 'after_order_details' => esc_html__( 'After Order details', 'merchant' ),
822 ),
823 'default' => 'before_order_details',
824 ),
825
826 array(
827 'id' => 'discount_text',
828 'type' => 'text',
829 'title' => esc_html__( 'Discount text', 'merchant' ),
830 'default' => esc_html__( '{product_price}', 'merchant' ),
831 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
832 'hidden_desc' => sprintf(
833 /* Translators: %1$s: Discount amount, %2$s: product price */
834 __(
835 '<strong>%1$s:</strong> to show the discount amount<br><strong>%2$s:</strong> to show the product price before and after the offer discount',
836 'merchant'
837 ),
838 '{discount}',
839 '{product_price}'
840 ),
841 ),
842
843 array(
844 'id' => 'bonus_tip_text',
845 'type' => 'text',
846 'title' => esc_html__( 'Bonus tip text', 'merchant' ),
847 'default' => esc_html__( 'Bonus: You will also receive this discount off each item you just purchased as part of this bulk discount offer.', 'merchant' ),
848 ),
849
850 array(
851 'id' => 'button_text',
852 'type' => 'text',
853 'title' => esc_html__( 'Button text', 'merchant' ),
854 'default' => esc_html__( 'Add To Cart', 'merchant' ),
855 ),
856 ),
857 ),
858 ),
859 ),
860 ),
861 'default' => array(
862 array(
863 'layout' => 'offer-details',
864 'min_quantity' => 2,
865 'discount' => 10,
866 'discount_type' => 'fixed_discount',
867 ),
868 ),
869 ),
870 ),
871 ) );
872
873 Merchant_Admin_Options::create( array(
874 'title' => esc_html__( 'General', 'merchant' ),
875 'module' => Merchant_Volume_Discounts::MODULE_ID,
876 'fields' => array(
877 array(
878 'id' => 'max_checkout_offers',
879 'type' => 'number',
880 'title' => __( 'Max offers on checkout page', 'merchant' ),
881 'desc' => __( 'Set the maximum offers can be displayed on the checkout page.', 'merchant' ),
882 'default' => 3,
883 ),
884
885 array(
886 'id' => 'offers_display_style',
887 'type' => 'radio',
888 'title' => esc_html__( 'Discount Display Style', 'merchant' ),
889 'options' => array(
890 'standard' => esc_html__( 'Standard Boxes', 'merchant' ),
891 'radio' => esc_html__( 'Tiered Radio Select', 'merchant' ),
892 ),
893 'default' => 'standard',
894 ),
895 ),
896 ) );
897
898 // Shortcode
899 $merchant_module_id = Merchant_Volume_Discounts::MODULE_ID;
900 Merchant_Admin_Options::create( array(
901 'module' => $merchant_module_id,
902 'title' => esc_html__( 'Use shortcode', 'merchant' ),
903 'fields' => array(
904 array(
905 'id' => 'use_shortcode',
906 'type' => 'switcher',
907 'title' => __( 'Use shortcode', 'merchant' ),
908 'default' => 0,
909 ),
910 array(
911 'type' => 'info',
912 'id' => 'shortcode_info',
913 '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.',
914 'merchant' ),
915 ),
916 array(
917 'id' => 'shortcode_text',
918 'type' => 'text_readonly',
919 'title' => esc_html__( 'Shortcode text', 'merchant' ),
920 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']',
921 'condition' => array( 'use_shortcode', '==', '1' ),
922 ),
923 ),
924 ) );
925