PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.5
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.5
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 1.10.5, at inc/modules/frequently-bought-together/admin/options.php

604 lines 22.9 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 'fields' => array(
30 array(
31 'id' => 'offer-title',
32 'type' => 'text',
33 'title' => esc_html__( 'Offer name', 'merchant' ),
34 'default' => esc_html__( 'Campaign', 'merchant' ),
35 ),
36 array(
37 'id' => 'rules_to_display',
38 'type' => 'select',
39 'title' => esc_html__( 'Trigger', 'merchant' ),
40 'options' => array(
41 'all' => esc_html__( 'All Products', 'merchant' ),
42 'products' => esc_html__( 'Specific Products', 'merchant' ),
43 'categories' => esc_html__( 'Specific Categories', 'merchant' ),
44 'tags' => esc_html__( 'Specific Tags', 'merchant' ),
45 ),
46 'default' => 'products',
47 ),
48 array(
49 'id' => 'product_to_display',
50 'type' => 'products_selector',
51 'title' => esc_html__( 'Select a product', 'merchant' ),
52 'multiple' => false,
53 'desc' => esc_html__( 'Select the product that you want to create the bundle for.', 'merchant' ),
54 'condition' => array( 'rules_to_display', '==', 'products' ),
55 ),
56 array(
57 'id' => 'category_slugs',
58 'type' => 'select_ajax',
59 'title' => esc_html__( 'Categories', 'merchant' ),
60 'source' => 'options',
61 'multiple' => true,
62 'options' => Merchant_Admin_Options::get_category_select2_choices(),
63 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
64 'desc' => esc_html__( 'Select the product categories that will show the offer.', 'merchant' ),
65 'condition' => array( 'rules_to_display', '==', 'categories' ),
66 ),
67
68 array(
69 'id' => 'tag_slugs',
70 'type' => 'select_ajax',
71 'title' => esc_html__( 'Tags', 'merchant' ),
72 'source' => 'options',
73 'multiple' => true,
74 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
75 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
76 'desc' => esc_html__( 'Select the product tags that will show the offer.', 'merchant' ),
77 'condition' => array( 'rules_to_display', '==', 'tags' ),
78 ),
79
80 array(
81 'id' => 'exclusion_enabled',
82 'type' => 'switcher',
83 'title' => esc_html__( 'Exclusion List', 'merchant' ),
84 'desc' => esc_html__( 'Select the products that will not show the offer.', 'merchant' ),
85 'default' => 0,
86 'conditions' => array(
87 'relation' => 'AND',
88 'terms' => array(
89 array(
90 'field' => 'rules_to_display',
91 'operator' => 'in',
92 'value' => array( 'all', 'categories', 'tags' ),
93 ),
94 ),
95 ),
96 ),
97
98 array(
99 'id' => 'excluded_products',
100 'type' => 'products_selector',
101 'title' => esc_html__( 'Exclude Products', 'merchant' ),
102 'multiple' => true,
103 'desc' => esc_html__( 'Exclude products from this campaign.', 'merchant' ),
104 'conditions' => array(
105 'relation' => 'AND',
106 'terms' => array(
107 array(
108 'field' => 'rules_to_display',
109 'operator' => 'in',
110 'value' => array( 'all', 'categories', 'tags' ),
111 ),
112 array(
113 'field' => 'exclusion_enabled',
114 'operator' => '===',
115 'value' => true,
116 ),
117 ),
118 ),
119 ),
120
121 array(
122 'id' => 'excluded_categories',
123 'type' => 'select_ajax',
124 'title' => esc_html__( 'Exclude Categories', 'merchant' ),
125 'source' => 'options',
126 'multiple' => true,
127 'options' => Merchant_Admin_Options::get_category_select2_choices(),
128 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
129 'desc' => esc_html__( 'Exclude categories 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' ),
137 ),
138 array(
139 'field' => 'exclusion_enabled',
140 'operator' => '===',
141 'value' => true,
142 ),
143 ),
144 ),
145 ),
146
147 array(
148 'id' => 'excluded_tags',
149 'type' => 'select_ajax',
150 'title' => esc_html__( 'Exclude Tags', 'merchant' ),
151 'source' => 'options',
152 'multiple' => true,
153 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
154 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
155 'desc' => esc_html__( 'Exclude tags from this campaign.', 'merchant' ),
156 'conditions' => array(
157 'relation' => 'AND',
158 'terms' => array(
159 array(
160 'field' => 'rules_to_display',
161 'operator' => 'in',
162 'value' => array( 'all' ),
163 ),
164 array(
165 'field' => 'exclusion_enabled',
166 'operator' => '===',
167 'value' => true,
168 ),
169 ),
170 ),
171 ),
172
173 array(
174 'id' => 'products',
175 'title' => esc_html__( 'Products to offer', 'merchant' ),
176 'type' => 'products_selector',
177 'multiple' => true,
178 'desc' => esc_html__( 'Select the products that will be included the bundle.', 'merchant' ),
179 ),
180
181 array(
182 'id' => 'external',
183 'label' => __( 'Display the offer on all products in the bundle', 'merchant' ),
184 'type' => 'checkbox',
185 'default' => 0,
186 'condition' => array( 'rules_to_display', '==', 'products' ),
187 ),
188 array(
189 'id' => 'enable_discount',
190 'type' => 'switcher',
191 'title' => __( 'Offer a discount on this bundle', 'merchant' ),
192 'default' => 0,
193 ),
194 array(
195 'id' => 'discount_type',
196 'type' => 'radio',
197 'title' => esc_html__( 'Discount', 'merchant' ),
198 'options' => array(
199 'percentage_discount' => esc_html__( 'Percentage', 'merchant' ),
200 'fixed_discount' => esc_html__( 'Fixed', 'merchant' ),
201 ),
202 'default' => 'percentage_discount',
203 'condition' => array( 'enable_discount', '==', '1' ),
204 ),
205 array(
206 'id' => 'discount_value',
207 'type' => 'number',
208 'default' => 10,
209 'step' => 0.01,
210 'condition' => array( 'enable_discount', '==', '1' ),
211 ),
212
213 array(
214 'id' => 'user_condition',
215 'type' => 'select',
216 'title' => esc_html__( 'User Condition', 'merchant' ),
217 'options' => array(
218 'all' => esc_html__( 'All Users', 'merchant' ),
219 'customers' => esc_html__( 'Selected Users', 'merchant' ),
220 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
221 ),
222 'default' => 'all',
223 ),
224
225 array(
226 'id' => 'user_condition_roles',
227 'type' => 'select_ajax',
228 'title' => esc_html__( 'User Roles', 'merchant' ),
229 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
230 'source' => 'options',
231 'multiple' => true,
232 'classes' => array( 'flex-grow' ),
233 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
234 'condition' => array( 'user_condition', '==', 'roles' ),
235 ),
236
237 array(
238 'id' => 'user_condition_users',
239 'type' => 'select_ajax',
240 'title' => esc_html__( 'Users', 'merchant' ),
241 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
242 'source' => 'user',
243 'multiple' => true,
244 'classes' => array( 'flex-grow' ),
245 'condition' => array( 'user_condition', '==', 'customers' ),
246 ),
247
248 array(
249 'id' => 'product_single_page',
250 'type' => 'fields_group',
251 'title' => esc_html__( 'Product Single Page', 'merchant' ),
252 'sub-desc' => esc_html__( 'Use these settings to control how frequently bought together offers appear on product pages.',
253 'merchant' ),
254 'state' => 'open',
255 'default' => 'active',
256 'accordion' => true,
257 'display_status' => true,
258 'fields' => array(
259 array(
260 'id' => 'single_product_placement',
261 'type' => 'hook_select',
262 'title' => esc_html__('Placement on product page', 'merchant'),
263 'options' => array(
264 'after-summary' => esc_html__( 'After Product Summary', 'merchant' ),
265 'after-tabs' => esc_html__( 'After Product Tabs', 'merchant' ),
266 'bottom' => esc_html__( 'At the Bottom', 'merchant' ),
267 ),
268 'min' => -999,
269 'max' => 999,
270 'step' => 1,
271 'unit' => '',
272 'order' => true,
273 'default' => array(
274 'hook_name' => 'after-summary',
275 'hook_priority' => 10,
276 ),
277 ),
278
279 // text formatting settings
280 array(
281 'id' => 'title',
282 'type' => 'text',
283 'title' => esc_html__( 'Bundle title', 'merchant' ),
284 'default' => esc_html__( 'Frequently Bought Together', 'merchant' ),
285 ),
286
287 array(
288 'id' => 'price_label',
289 'type' => 'text',
290 'title' => esc_html__( 'Price label', 'merchant' ),
291 'default' => esc_html__( 'Bundle price', 'merchant' ),
292 ),
293
294 array(
295 'id' => 'save_label',
296 'type' => 'text',
297 'title' => esc_html__( 'You save label', 'merchant' ),
298 'default' => esc_html__( 'You save: {amount}', 'merchant' ),
299 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
300 'hidden_desc' => sprintf(
301 /* Translators: %1$s: Discount amount */
302 __(
303 '<strong>%1$s:</strong> to show discount amount',
304 'merchant'
305 ),
306 '{amount}'
307 ),
308 ),
309
310 array(
311 'id' => 'no_variation_selected_text',
312 'type' => 'text',
313 'title' => esc_html__( 'No variation selected text', 'merchant' ),
314 'default' => esc_html__( 'Please select an option to see your savings.', 'merchant' ),
315 ),
316
317 array(
318 'id' => 'no_variation_selected_text_has_no_discount',
319 'type' => 'text',
320 'title' => esc_html__( 'No variation selected text (no discount)', 'merchant' ),
321 'desc' => esc_html__( 'This text will be displayed when the bundle has no discount and includes a variable product.', 'merchant' ),
322 'default' => esc_html__( 'Please select an option to see the total price.', 'merchant' ),
323 ),
324
325 array(
326 'id' => 'button_text',
327 'type' => 'text',
328 'title' => esc_html__( 'Button text', 'merchant' ),
329 'default' => esc_html__( 'Add to cart', 'merchant' ),
330 ),
331
332 // style settings
333 array(
334 'id' => 'plus_bg_color',
335 'type' => 'color',
336 'title' => esc_html__( 'Plus sign background color', 'merchant' ),
337 'default' => '#212121',
338 ),
339
340 array(
341 'id' => 'plus_text_color',
342 'type' => 'color',
343 'title' => esc_html__( 'Plus sign text color', 'merchant' ),
344 'default' => '#fff',
345 ),
346
347 array(
348 'id' => 'bundle_border_color',
349 'type' => 'color',
350 'title' => esc_html__( 'Bundle border color', 'merchant' ),
351 'default' => '#f9f9f9',
352 ),
353
354 array(
355 'id' => 'bundle_border_radius',
356 'type' => 'range',
357 'title' => esc_html__( 'Bundle border radius', 'merchant' ),
358 'min' => 0,
359 'max' => 100,
360 'step' => 1,
361 'unit' => 'px',
362 'default' => 5,
363 ),
364 ),
365 ),
366
367 array(
368 'id' => 'cart_page',
369 'type' => 'fields_group',
370 'title' => esc_html__( 'Cart Page', 'merchant' ),
371 'default' => 'inactive',
372 'sub-desc' => esc_html__( 'Use these settings to control how frequently bought together offers appear on the cart page.', 'merchant' ),
373 'state' => 'closed',
374 'accordion' => true,
375 'display_status' => true,
376 'fields' => array(
377 // text formatting settings
378 array(
379 'id' => 'title',
380 'type' => 'text',
381 'title' => esc_html__( 'Bundle title', 'merchant' ),
382 'default' => esc_html__( 'Add', 'merchant' ),
383 ),
384
385 // array(
386 // 'id' => 'price_label',
387 // 'type' => 'text',
388 // 'title' => esc_html__( 'Price label', 'merchant' ),
389 // 'default' => esc_html__( 'Bundle price', 'merchant' ),
390 // ),
391
392 array(
393 'id' => 'save_label',
394 'type' => 'text',
395 'title' => esc_html__( 'And save label', 'merchant' ),
396 'default' => esc_html__( 'and save: {amount}', 'merchant' ),
397 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
398 'hidden_desc' => sprintf(
399 /* Translators: %1$s: Discount amount */
400 __(
401 '<strong>%1$s:</strong> to show discount amount',
402 'merchant'
403 ),
404 '{amount}'
405 ),
406 ),
407
408 // array(
409 // 'id' => 'no_variation_selected_text',
410 // 'type' => 'text',
411 // 'title' => esc_html__( 'No variation selected text', 'merchant' ),
412 // 'default' => esc_html__( 'Please select an option to see your savings.', 'merchant' ),
413 // ),
414 //
415 // array(
416 // 'id' => 'no_variation_selected_text_has_no_discount',
417 // 'type' => 'text',
418 // 'title' => esc_html__( 'No variation selected text (no discount)', 'merchant' ),
419 // 'desc' => esc_html__( 'This text will be displayed when the bundle has no discount and includes a variable product.', 'merchant' ),
420 // 'default' => esc_html__( 'Please select an option to see the total price.', 'merchant' ),
421 // ),
422
423 array(
424 'id' => 'button_text',
425 'type' => 'text',
426 'title' => esc_html__( 'Button text', 'merchant' ),
427 'default' => esc_html__( 'Add to cart', 'merchant' ),
428 ),
429 ),
430 ),
431 array(
432 'id' => 'checkout_page',
433 'type' => 'fields_group',
434 'title' => esc_html__( 'Checkout Page', 'merchant' ),
435 'sub-desc' => esc_html__( 'Use these settings to control how Frequently bought together offers appear on the checkout page.', 'merchant' ),
436 'state' => 'closed',
437 'default' => 'inactive',
438 'accordion' => true,
439 'display_status' => true,
440 'fields' => array(
441 array(
442 'id' => 'placement',
443 'type' => 'select',
444 'title' => esc_html__( 'Placement', 'merchant' ),
445 'options' => array(
446 'before_billing_details' => esc_html__( 'Before Billing Details', 'merchant' ),
447 'after_billing_details' => esc_html__( 'After Billing Details', 'merchant' ),
448 'before_order_details' => esc_html__( 'Before Order Details', 'merchant' ),
449 'before_payment_options' => esc_html__( 'Before Payment Gateways', 'merchant' ),
450 'before_order_placement_btn' => esc_html__( 'Before Order Placement Button', 'merchant' ),
451 'after_order_placement_btn' => esc_html__( 'After Order Placement Button', 'merchant' ),
452 ),
453 'default' => 'before_payment_options',
454 ),
455 array(
456 'id' => 'title',
457 'type' => 'text',
458 'title' => esc_html__( 'Offer title', 'merchant' ),
459 'default' => esc_html__( 'Bundle and Save!', 'merchant' ),
460 ),
461 array(
462 'id' => 'discount_text',
463 'type' => 'text',
464 'title' => esc_html__( 'Discount text', 'merchant' ),
465 'default' => esc_html__( 'Add to get {discount} off all items in your bundle ({fbt_products}).', 'merchant' ),
466 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
467 'hidden_desc' => sprintf(
468 /* Translators: %1$s: Discount amount, %2$s: FBT offer product names */
469 __(
470 '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show the product names in the offer',
471 'merchant'
472 ),
473 '{discount}',
474 '{fbt_products}'
475 ),
476 ),
477 array(
478 'id' => 'button_text',
479 'type' => 'text',
480 'title' => esc_html__( 'Button text', 'merchant' ),
481 'default' => esc_html__( 'Add To Cart', 'merchant' ),
482 ),
483 ),
484 ),
485 array(
486 'id' => 'thank_you_page',
487 'type' => 'fields_group',
488 'title' => esc_html__( 'Thank you Page', 'merchant' ),
489 'default' => 'inactive',
490 'sub-desc' => esc_html__( 'Use these settings to control how frequently bought together offers appear on the thank you page.', 'merchant' ),
491 'state' => 'closed',
492 'accordion' => true,
493 'display_status' => true,
494 'fields' => array(
495 array(
496 'id' => 'title',
497 'type' => 'text',
498 'title' => esc_html__( 'Bundle title', 'merchant' ),
499 'default' => esc_html__( 'Last chance to get {discount} off your bundle!', 'merchant' ),
500 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
501 'hidden_desc' => sprintf(
502 /* Translators: %1$s: Discount amount */
503 __(
504 '<strong>%1$s:</strong> to show discount amount',
505 'merchant'
506 ),
507 '{discount}'
508 ),
509 ),
510
511 array(
512 'id' => 'placement',
513 'type' => 'select',
514 'title' => esc_html__( 'Placement', 'merchant' ),
515 'options' => array(
516 'on_top' => esc_html__( 'On Top', 'merchant' ),
517 'before_order_details' => esc_html__( 'Before Order details', 'merchant' ),
518 'after_order_details' => esc_html__( 'After Order details', 'merchant' ),
519 ),
520 'default' => 'before_order_details',
521 ),
522
523 array(
524 'id' => 'discount_text',
525 'type' => 'text',
526 'title' => esc_html__( 'Discount text', 'merchant' ),
527 'default' => esc_html__( 'Add now to complete your bundle ({fbt_products}) and save', 'merchant' ),
528 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
529 'hidden_desc' => sprintf(
530 /* Translators: %1$s: Discount amount */
531 __(
532 '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show the product names in the offer',
533 'merchant'
534 ),
535 '{discount}',
536 '{fbt_products}'
537 ),
538 ),
539 array(
540 'id' => 'bonus_tip_text',
541 'type' => 'textarea',
542 'title' => esc_html__( 'Bonus tip text', 'merchant' ),
543 '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. ', 'merchant' ),
544 'desc' => __( 'You can use these codes in the content.', 'merchant' ),
545 'hidden_desc' => sprintf(
546 /* Translators: %1$s: Discount amount */
547 __(
548 '<strong>%1$s:</strong> to show discount amount<br><strong>%2$s:</strong> to show the product names in the offer',
549 'merchant'
550 ),
551 '{discount}',
552 '{fbt_products}'
553 ),
554 ),
555 array(
556 'id' => 'button_text',
557 'type' => 'text',
558 'title' => esc_html__( 'Button text', 'merchant' ),
559 'default' => esc_html__( 'Add to cart', 'merchant' ),
560 ),
561 ),
562 ),
563 ),
564 ),
565 ),
566 'default' => array(
567 array(
568 'layout' => 'offer-details',
569 'min_quantity' => 2,
570 'discount' => 10,
571 'discount_type' => 'percentage_discount',
572 ),
573 ),
574 ),
575 ),
576 ) );
577
578 // Shortcode
579 $merchant_module_id = Merchant_Frequently_Bought_Together::MODULE_ID;
580 Merchant_Admin_Options::create( array(
581 'module' => $merchant_module_id,
582 'title' => esc_html__( 'Use shortcode', 'merchant' ),
583 'fields' => array(
584 array(
585 'id' => 'use_shortcode',
586 'type' => 'switcher',
587 'title' => __( 'Use shortcode', 'merchant' ),
588 'default' => 0,
589 ),
590 array(
591 'type' => 'info',
592 'id' => 'shortcode_info',
593 '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.',
594 'merchant' ),
595 ),
596 array(
597 'id' => 'shortcode_text',
598 'type' => 'text_readonly',
599 'title' => esc_html__( 'Shortcode text', 'merchant' ),
600 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']',
601 'condition' => array( 'use_shortcode', '==', '1' ),
602 ),
603 ),
604 ) );