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

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