PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.0
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.0
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / modules / pre-orders / admin / options.php

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

806 lines 30.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Pre Orders.
4 *
5 * @package Merchant
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12
13 /**
14 * Hook functionality before including modules options.
15 *
16 * @since 1.9.8
17 */
18
19 return array(
20 array(
21 'title' => esc_html__( 'Pre-order Rule', 'merchant' ),
22 'module' => Merchant_Pre_Orders::MODULE_ID,
23 'fields' => array(
24 array(
25 'id' => 'rules',
26 'type' => 'flexible_content',
27 'sorting' => true,
28 'duplicate' => true,
29 'accordion' => true,
30 'style' => Merchant_Pre_Orders::MODULE_ID . '-style default',
31 'button_label' => esc_html__( 'Add New Pre-Order', 'merchant' ),
32 'layouts' => array(
33 'rule-details' => array(
34 'title' => esc_html__( 'Campaign', 'merchant' ),
35 'title-field' => 'offer-title', // text field ID to use as title for the layout
36 'status-field' => 'campaign_status',
37 'fields' => array(
38 array(
39 'id' => 'campaign_status',
40 'type' => 'select',
41 'title' => esc_html__( 'Status', 'merchant' ),
42 'options' => array(
43 'active' => esc_html__( 'Active', 'merchant' ),
44 'inactive' => esc_html__( 'Inactive', 'merchant' ),
45 ),
46 'default' => 'active',
47 'ai_meta' => array(
48 'usage_hint' => 'Controls whether this campaign is active or inactive. Set to active to enable, inactive to disable.',
49 ),
50 ),
51 array(
52 'id' => 'offer-title',
53 'type' => 'text',
54 'title' => esc_html__( 'Order name', 'merchant' ),
55 'default' => esc_html__( 'Custom Pre-order', 'merchant' ),
56 'desc' => esc_html__( 'Internal campaign name. This is not visible to customers.', 'merchant' ),
57 ),
58 array(
59 'id' => 'trigger_on',
60 'type' => 'select',
61 'title' => esc_html__( 'Trigger', 'merchant' ),
62 'options' => array(
63 'all' => esc_html__( 'All Products', 'merchant' ),
64 'product' => esc_html__( 'Specific Products', 'merchant' ),
65 'category' => esc_html__( 'Specific Categories', 'merchant' ),
66 'tags' => esc_html__( 'Specific Tags', 'merchant' ),
67 'brands' => esc_html__( 'Specific Brands', 'merchant' ),
68 ),
69 'default' => 'product',
70 'ai_meta' => array(
71 'semantic_group' => 'product_targeting',
72 'usage_hint' => 'Controls which products this pre-order campaign applies to. Set this BEFORE setting product_ids, category_slugs, tag_slugs, or brand_slugs — those fields are conditional on this value.',
73 ),
74 ),
75 array(
76 'id' => 'product_ids',
77 'type' => 'products_selector',
78 'multiple' => true,
79 'allowed_types' => array( 'simple', 'variable', 'variation', 'merchant_pro_bundle' ),
80 'desc' => esc_html__( 'Select the product(s) included in this pre-order.', 'merchant' ),
81 'condition' => array( 'trigger_on', '==', 'product' ),
82 'ai_meta' => array(
83 'entity' => 'product',
84 'reference_type' => 'static',
85 'value_format' => 'product_id',
86 'semantic_group' => 'product_targeting',
87 'abstraction_level' => 1,
88 'usage_hint' => 'Product IDs included in this pre-order. Only used when trigger_on is set to product.',
89 ),
90 ),
91 array(
92 'id' => 'category_slugs',
93 'type' => 'select_ajax',
94 'title' => esc_html__( 'Categories', 'merchant' ),
95 'source' => 'options',
96 'multiple' => true,
97 'options' => Merchant_Admin_Options::get_category_select2_choices(),
98 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
99 'desc' => esc_html__( 'Select the category or categories for which the products will be available for pre-order.', 'merchant' ),
100 'condition' => array( 'trigger_on', '==', 'category' ),
101 'ai_meta' => array(
102 'entity' => 'category',
103 'reference_type' => 'dynamic',
104 'taxonomy' => 'product_cat',
105 'value_format' => 'slug',
106 'semantic_group' => 'product_targeting',
107 'abstraction_level' => 3,
108 'usage_hint' => 'Category slugs for this pre-order. Only used when trigger_on is set to category.',
109 ),
110 ),
111 array(
112 'id' => 'tag_slugs',
113 'type' => 'select_ajax',
114 'title' => esc_html__( 'Tags', 'merchant' ),
115 'source' => 'options',
116 'multiple' => true,
117 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
118 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
119 'desc' => esc_html__( 'Select the tag or tags for which the products will be available for pre-order.', 'merchant' ),
120 'condition' => array( 'trigger_on', '==', 'tags' ),
121 'ai_meta' => array(
122 'entity' => 'tag',
123 'reference_type' => 'dynamic',
124 'taxonomy' => 'product_tag',
125 'value_format' => 'slug',
126 'semantic_group' => 'product_targeting',
127 'abstraction_level' => 2,
128 'usage_hint' => 'Tag slugs for this pre-order. Only used when trigger_on is set to tags.',
129 ),
130 ),
131 array(
132 'id' => 'brand_slugs',
133 'type' => 'select_ajax',
134 'title' => esc_html__( 'Brands', 'merchant' ),
135 'source' => 'options',
136 'multiple' => true,
137 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
138 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
139 'desc' => esc_html__( 'Select the brand or brands for which the products will be available for pre-order.', 'merchant' ),
140 'condition' => array( 'trigger_on', '==', 'brands' ),
141 'ai_meta' => array(
142 'entity' => 'brand',
143 'reference_type' => 'dynamic',
144 'taxonomy' => 'product_brand',
145 'value_format' => 'slug',
146 'semantic_group' => 'product_targeting',
147 'abstraction_level' => 4,
148 'usage_hint' => 'Brand slugs for this pre-order. Only used when trigger_on is set to brands.',
149 ),
150 ),
151
152 // Individual exclusion toggles
153 array(
154 'id' => 'exclude_products_toggle',
155 'type' => 'switcher',
156 'title' => esc_html__( 'Exclude products', 'merchant' ),
157 'desc' => esc_html__( 'Exclude specific products from this pre-order campaign.', 'merchant' ),
158 'default' => 0,
159 'conditions' => array(
160 'relation' => 'AND',
161 'terms' => array(
162 array(
163 'field' => 'trigger_on',
164 'operator' => 'in',
165 'value' => array( 'all', 'category', 'tags', 'brands' ),
166 ),
167 ),
168 ),
169 'ai_meta' => array(
170 'toggle_for' => 'excluded_products',
171 'semantic_group' => 'product_exclusion',
172 'usage_hint' => 'Enable this to reveal the excluded_products field.',
173 ),
174 ),
175
176 array(
177 'id' => 'excluded_products',
178 'type' => 'products_selector',
179 'title' => esc_html__( 'Excluded Products List', 'merchant' ),
180 'desc' => esc_html__( 'Exclude products from this pre-order campaign.', 'merchant' ),
181 'allowed_types' => array( 'simple', 'variable' ),
182 'multiple' => true,
183 'ai_meta' => array(
184 'entity' => 'product',
185 'reference_type' => 'static',
186 'value_format' => 'product_id',
187 'semantic_group' => 'product_exclusion',
188 'abstraction_level' => 1,
189 'toggled_by' => 'exclude_products_toggle',
190 'usage_hint' => 'Products excluded from this pre-order campaign. Requires exclude_products_toggle.',
191 ),
192 'conditions' => array(
193 'relation' => 'AND',
194 'terms' => array(
195 array(
196 'field' => 'trigger_on',
197 'operator' => 'in',
198 'value' => array( 'all', 'category', 'tags', 'brands' ),
199 ),
200 array(
201 'field' => 'exclude_products_toggle',
202 'operator' => '===',
203 'value' => true,
204 ),
205 ),
206 ),
207 ),
208
209 array(
210 'id' => 'exclude_categories_toggle',
211 'type' => 'switcher',
212 'title' => esc_html__( 'Exclude categories', 'merchant' ),
213 'desc' => esc_html__( 'Exclude specific categories from this pre-order campaign.', 'merchant' ),
214 'default' => 0,
215 'conditions' => array(
216 'relation' => 'AND',
217 'terms' => array(
218 array(
219 'field' => 'trigger_on',
220 'operator' => 'in',
221 'value' => array( 'all', 'tags', 'brands' ),
222 ),
223 ),
224 ),
225 'ai_meta' => array(
226 'toggle_for' => 'excluded_categories',
227 'semantic_group' => 'product_exclusion',
228 'usage_hint' => 'Enable this to reveal the excluded_categories field.',
229 ),
230 ),
231
232 array(
233 'id' => 'excluded_categories',
234 'type' => 'select_ajax',
235 'title' => esc_html__( 'Excluded Categories List', 'merchant' ),
236 'source' => 'options',
237 'multiple' => true,
238 'options' => Merchant_Admin_Options::get_category_select2_choices(),
239 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
240 'desc' => esc_html__( 'Exclude categories from this pre-order campaign.', 'merchant' ),
241 'ai_meta' => array(
242 'entity' => 'category',
243 'reference_type' => 'dynamic',
244 'taxonomy' => 'product_cat',
245 'value_format' => 'slug',
246 'semantic_group' => 'product_exclusion',
247 'abstraction_level' => 3,
248 'toggled_by' => 'exclude_categories_toggle',
249 'usage_hint' => 'Categories excluded from this pre-order campaign. Requires exclude_categories_toggle.',
250 ),
251 'conditions' => array(
252 'relation' => 'AND',
253 'terms' => array(
254 array(
255 'field' => 'trigger_on',
256 'operator' => 'in',
257 'value' => array( 'all', 'tags', 'brands' ),
258 ),
259 array(
260 'field' => 'exclude_categories_toggle',
261 'operator' => '===',
262 'value' => true,
263 ),
264 ),
265 ),
266 ),
267
268 array(
269 'id' => 'exclude_tags_toggle',
270 'type' => 'switcher',
271 'title' => esc_html__( 'Exclude tags', 'merchant' ),
272 'desc' => esc_html__( 'Exclude specific tags from this pre-order campaign.', 'merchant' ),
273 'default' => 0,
274 'conditions' => array(
275 'relation' => 'AND',
276 'terms' => array(
277 array(
278 'field' => 'trigger_on',
279 'operator' => 'in',
280 'value' => array( 'all', 'category', 'brands' ),
281 ),
282 ),
283 ),
284 'ai_meta' => array(
285 'toggle_for' => 'excluded_tags',
286 'semantic_group' => 'product_exclusion',
287 'usage_hint' => 'Enable this to reveal the excluded_tags field.',
288 ),
289 ),
290
291 array(
292 'id' => 'excluded_tags',
293 'type' => 'select_ajax',
294 'title' => esc_html__( 'Excluded Tags List', 'merchant' ),
295 'source' => 'options',
296 'multiple' => true,
297 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
298 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
299 'desc' => esc_html__( 'Exclude tags from this pre-order campaign.', 'merchant' ),
300 'ai_meta' => array(
301 'entity' => 'tag',
302 'reference_type' => 'dynamic',
303 'taxonomy' => 'product_tag',
304 'value_format' => 'slug',
305 'semantic_group' => 'product_exclusion',
306 'abstraction_level' => 2,
307 'toggled_by' => 'exclude_tags_toggle',
308 'usage_hint' => 'Tags excluded from this pre-order campaign. Requires exclude_tags_toggle.',
309 ),
310 'conditions' => array(
311 'relation' => 'AND',
312 'terms' => array(
313 array(
314 'field' => 'trigger_on',
315 'operator' => 'in',
316 'value' => array( 'all', 'category', 'brands' ),
317 ),
318 array(
319 'field' => 'exclude_tags_toggle',
320 'operator' => '===',
321 'value' => true,
322 ),
323 ),
324 ),
325 ),
326
327 array(
328 'id' => 'exclude_brands_toggle',
329 'type' => 'switcher',
330 'title' => esc_html__( 'Exclude brands', 'merchant' ),
331 'desc' => esc_html__( 'Exclude specific brands from this pre-order campaign.', 'merchant' ),
332 'default' => 0,
333 'conditions' => array(
334 'relation' => 'AND',
335 'terms' => array(
336 array(
337 'field' => 'trigger_on',
338 'operator' => 'in',
339 'value' => array( 'all', 'category', 'tags' ),
340 ),
341 ),
342 ),
343 'ai_meta' => array(
344 'toggle_for' => 'excluded_brands',
345 'semantic_group' => 'product_exclusion',
346 'usage_hint' => 'Enable this to reveal the excluded_brands field.',
347 ),
348 ),
349
350 array(
351 'id' => 'excluded_brands',
352 'type' => 'select_ajax',
353 'title' => esc_html__( 'Excluded Brands List', 'merchant' ),
354 'source' => 'options',
355 'multiple' => true,
356 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
357 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
358 'desc' => esc_html__( 'Exclude brands from this pre-order campaign.', 'merchant' ),
359 'ai_meta' => array(
360 'entity' => 'brand',
361 'reference_type' => 'dynamic',
362 'taxonomy' => 'product_brand',
363 'value_format' => 'slug',
364 'semantic_group' => 'product_exclusion',
365 'abstraction_level' => 4,
366 'toggled_by' => 'exclude_brands_toggle',
367 'usage_hint' => 'Brands excluded from this pre-order campaign. Requires exclude_brands_toggle.',
368 ),
369 'conditions' => array(
370 'relation' => 'AND',
371 'terms' => array(
372 array(
373 'field' => 'trigger_on',
374 'operator' => 'in',
375 'value' => array( 'all', 'category', 'tags' ),
376 ),
377 array(
378 'field' => 'exclude_brands_toggle',
379 'operator' => '===',
380 'value' => true,
381 ),
382 ),
383 ),
384 ),
385
386 array(
387 'id' => 'discount_toggle',
388 'type' => 'switcher',
389 'title' => __( 'Do you want to offer a discount on this pre-order?', 'merchant' ),
390 'default' => 0,
391 'ai_meta' => array(
392 'toggle_for' => 'discount_type',
393 'semantic_group' => 'offer_rules',
394 'usage_hint' => 'Enable this to reveal discount_type and discount_amount fields for this pre-order.',
395 ),
396 ),
397 array(
398 'id' => 'discount_type',
399 'type' => 'radio',
400 'title' => esc_html__( 'Discount Type', 'merchant' ),
401 'options' => array(
402 'percentage' => esc_html__( 'Percentage', 'merchant' ),
403 'fixed' => esc_html__( 'Fixed', 'merchant' ),
404 ),
405 'default' => 'percentage',
406 'ai_meta' => array(
407 'semantic_group' => 'offer_rules',
408 'usage_hint' => 'Type of discount applied to this pre-order. Only relevant when discount_toggle is enabled.',
409 ),
410 'conditions' => array(
411 'terms' => array(
412 array(
413 'field' => 'discount_toggle', // field ID
414 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
415 'value' => true, // can be a single value or an array of string/number/int
416 ),
417 ),
418 ),
419 ),
420 array(
421 'id' => 'discount_amount',
422 'type' => 'number',
423 'step' => 0.01,
424 'default' => 10,
425 'ai_meta' => array(
426 'semantic_group' => 'offer_rules',
427 'usage_hint' => 'Discount amount for this pre-order. Interpretation depends on discount_type (percentage or fixed). Only relevant when discount_toggle is enabled.',
428 ),
429 'conditions' => array(
430 'terms' => array(
431 array(
432 'field' => 'discount_toggle', // field ID
433 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
434 'value' => true, // can be a single value or an array of string/number/int
435 ),
436 ),
437 ),
438 ),
439 array(
440 'id' => 'shipping_date',
441 'type' => 'date_time',
442 'title' => esc_html__( 'Shipping date', 'merchant' ),
443 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
444 'desc' => sprintf(
445 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
446 esc_html__( 'The times set above are in the %1$s timezone, according to your settings from %2$s.',
447 'merchant' ),
448 '<strong>' . wp_timezone_string() . '</strong>',
449 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
450 ),
451 'ai_meta' => array(
452 'allow_empty' => false,
453 'value_format' => 'm-d-Y h:i A',
454 'usage_hint' => 'Required. Shipping date in m-d-Y h:i A format (e.g., 06-24-2026 03:30 PM). Uses WordPress timezone.',
455 ),
456 ),
457 array(
458 'id' => 'pre_order_start',
459 'type' => 'date_time',
460 'title' => esc_html__( 'Pre-order starts at', 'merchant' ),
461 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
462 'desc' => esc_html__( 'If you want your pre-order settings to take effect immediately, leave the pre-order start empty.', 'merchant' ),
463 'ai_meta' => array(
464 'allow_empty' => true,
465 'value_format' => 'm-d-Y h:i A',
466 'usage_hint' => 'Optional. Leave empty to start immediately. Format: m-d-Y h:i A (e.g., 06-24-2026 03:30 PM).',
467 ),
468 ),
469 array(
470 'id' => 'pre_order_end',
471 'type' => 'date_time',
472 'title' => esc_html__( 'Pre-order ends at', 'merchant' ),
473 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
474 'desc' => sprintf(
475 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
476 esc_html__( 'Leave it empty if you don’t want to have an end date. The times set above are in the %1$s timezone, according to your settings from %2$s.',
477 'merchant' ),
478 '<strong>' . wp_timezone_string() . '</strong>',
479 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
480 ),
481 'ai_meta' => array(
482 'allow_empty' => true,
483 'value_format' => 'm-d-Y h:i A',
484 'usage_hint' => 'Optional. Leave empty for no end date. Format: m-d-Y h:i A (e.g., 06-24-2026 03:30 PM).',
485 ),
486 ),
487
488 array(
489 'id' => 'user_condition',
490 'type' => 'select',
491 'title' => esc_html__( 'User Condition', 'merchant' ),
492 'options' => array(
493 'all' => esc_html__( 'All Users', 'merchant' ),
494 'customers' => esc_html__( 'Selected Users', 'merchant' ),
495 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
496 ),
497 'default' => 'all',
498 'ai_meta' => array(
499 'semantic_group' => 'user_targeting',
500 'usage_hint' => 'Controls which users see this pre-order campaign. Set this BEFORE setting user_condition_users or user_condition_roles.',
501 ),
502 ),
503
504 array(
505 'id' => 'user_condition_roles',
506 'type' => 'select_ajax',
507 'title' => esc_html__( 'User Roles', 'merchant' ),
508 'desc' => esc_html__( 'This will limit the rule to users with these roles.', 'merchant' ),
509 'source' => 'options',
510 'multiple' => true,
511 'classes' => array( 'flex-grow' ),
512 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
513 'condition' => array( 'user_condition', '==', 'roles' ),
514 'ai_meta' => array(
515 'entity' => 'role',
516 'reference_type' => 'dynamic',
517 'value_format' => 'role_slug',
518 'semantic_group' => 'user_targeting',
519 'abstraction_level' => 2,
520 'usage_hint' => 'Roles allowed for this pre-order campaign. Only used when user_condition is roles.',
521 ),
522 ),
523
524 array(
525 'id' => 'user_condition_users',
526 'type' => 'select_ajax',
527 'title' => esc_html__( 'Users', 'merchant' ),
528 'desc' => esc_html__( 'This will limit the rule to the selected customers.', 'merchant' ),
529 'source' => 'user',
530 'multiple' => true,
531 'classes' => array( 'flex-grow' ),
532 'condition' => array( 'user_condition', '==', 'customers' ),
533 'ai_meta' => array(
534 'entity' => 'user',
535 'reference_type' => 'static',
536 'value_format' => 'user_id',
537 'semantic_group' => 'user_targeting',
538 'abstraction_level' => 1,
539 'usage_hint' => 'Specific users for this pre-order campaign. Only used when user_condition is customers.',
540 ),
541 ),
542
543 array(
544 'id' => 'user_exclusion_enabled',
545 'type' => 'switcher',
546 'title' => esc_html__( 'Exclusion List', 'merchant' ),
547 'desc' => esc_html__( 'Select the users that will not show the offer.', 'merchant' ),
548 'default' => 0,
549 'conditions' => array(
550 'relation' => 'AND',
551 'terms' => array(
552 array(
553 'field' => 'user_condition',
554 'operator' => 'in',
555 'value' => array( 'all', 'roles' ),
556 ),
557 ),
558 ),
559 'ai_meta' => array(
560 'toggle_for' => 'exclude_roles',
561 'semantic_group' => 'user_exclusion',
562 'usage_hint' => 'Enable this to reveal exclude_roles and exclude_users fields.',
563 ),
564 ),
565
566 array(
567 'id' => 'exclude_roles',
568 'type' => 'select_ajax',
569 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
570 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
571 'source' => 'options',
572 'multiple' => true,
573 'classes' => array( 'flex-grow' ),
574 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
575 'ai_meta' => array(
576 'entity' => 'role',
577 'reference_type' => 'dynamic',
578 'value_format' => 'role_slug',
579 'semantic_group' => 'user_exclusion',
580 'abstraction_level' => 2,
581 'toggled_by' => 'user_exclusion_enabled',
582 'usage_hint' => 'Roles excluded from this pre-order campaign. Requires user_exclusion_enabled.',
583 ),
584 'conditions' => array(
585 'relation' => 'AND',
586 'terms' => array(
587 array(
588 'field' => 'user_condition',
589 'operator' => 'in',
590 'value' => array( 'all' ),
591 ),
592 array(
593 'field' => 'user_exclusion_enabled',
594 'operator' => '===',
595 'value' => true,
596 ),
597 ),
598 ),
599 ),
600
601 array(
602 'id' => 'exclude_users',
603 'type' => 'select_ajax',
604 'title' => esc_html__( 'Exclude Users', 'merchant' ),
605 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
606 'source' => 'user',
607 'multiple' => true,
608 'classes' => array( 'flex-grow' ),
609 'ai_meta' => array(
610 'entity' => 'user',
611 'reference_type' => 'static',
612 'value_format' => 'user_id',
613 'semantic_group' => 'user_exclusion',
614 'abstraction_level' => 1,
615 'toggled_by' => 'user_exclusion_enabled',
616 'usage_hint' => 'Users excluded from this pre-order campaign. Requires user_exclusion_enabled.',
617 ),
618 'conditions' => array(
619 'relation' => 'AND',
620 'terms' => array(
621 array(
622 'field' => 'user_condition',
623 'operator' => 'in',
624 'value' => array( 'all', 'roles' ),
625 ),
626 array(
627 'field' => 'user_exclusion_enabled',
628 'operator' => '===',
629 'value' => true,
630 ),
631 ),
632 ),
633 ),
634
635 array(
636 'id' => 'button_text',
637 'type' => 'text',
638 'title' => esc_html__( 'Button text', 'merchant' ),
639 'default' => esc_html__( 'Pre-Order', 'merchant' ),
640 ),
641
642 array(
643 'id' => 'additional_text',
644 'type' => 'text',
645 'title' => esc_html__( 'Additional information', 'merchant' ),
646 'default' => esc_html__( 'Ships on {date}', 'merchant' ),
647 ),
648
649 array(
650 'id' => 'placement',
651 'type' => 'radio',
652 'title' => esc_html__( 'Placement', 'merchant' ),
653 'options' => array(
654 'before' => esc_html__( 'Before Button', 'merchant' ),
655 'after' => esc_html__( 'After Button', 'merchant' ),
656 ),
657 'default' => 'before',
658 ),
659 array(
660 'id' => 'cart_label_text',
661 'type' => 'text',
662 'title' => esc_html__( 'Label text on cart', 'merchant' ),
663 'default' => esc_html__( 'Ships on', 'merchant' ),
664 ),
665 array(
666 'id' => 'text-color',
667 'type' => 'color',
668 'title' => esc_html__( 'Button text color', 'merchant' ),
669 'default' => '#FFF',
670 ),
671
672 array(
673 'id' => 'text-hover-color',
674 'type' => 'color',
675 'title' => esc_html__( 'Button text color hover', 'merchant' ),
676 'default' => '#FFF',
677 ),
678
679 array(
680 'id' => 'border-color',
681 'type' => 'color',
682 'title' => esc_html__( 'Button border color', 'merchant' ),
683 'default' => '#212121',
684 ),
685
686 array(
687 'id' => 'border-hover-color',
688 'type' => 'color',
689 'title' => esc_html__( 'Button border color hover', 'merchant' ),
690 'default' => '#414141',
691 ),
692
693 array(
694 'id' => 'border-width',
695 'type' => 'range',
696 'title' => esc_html__( 'Button Border Width (px)', 'merchant' ),
697 'min' => 0,
698 'max' => 10,
699 'step' => 1,
700 'default' => 0,
701 ),
702
703 array(
704 'id' => 'border-radius',
705 'type' => 'range',
706 'title' => esc_html__( 'Button Border Radius (px)', 'merchant' ),
707 'min' => 0,
708 'max' => 50,
709 'step' => 1,
710 'default' => 0,
711 ),
712
713 array(
714 'id' => 'background-color',
715 'type' => 'color',
716 'title' => esc_html__( 'Button background color', 'merchant' ),
717 'default' => '#212121',
718 ),
719
720 array(
721 'id' => 'background-hover-color',
722 'type' => 'color',
723 'title' => esc_html__( 'Button background color hover', 'merchant' ),
724 'default' => '#414141',
725 ),
726 ),
727 ),
728 ),
729 'default' => array(
730 array(
731 'layout' => 'rule-details',
732 ),
733 ),
734 ),
735 array(
736 'id' => 'modes',
737 'type' => 'select',
738 'title' => esc_html__( 'Pre-order Modes', 'merchant' ),
739 'options' => array(
740 'only_pre_orders' => esc_html__( 'Allow only pre-orders', 'merchant' ),
741 'unified_order' => esc_html__( 'Treat the whole order as pre-order', 'merchant' ),
742 // 'separate_order_for_pre_orders' => esc_html__( 'Generate separate orders for each pre-order product', 'merchant' ),
743 // 'group_pre_order_into_one_order' => esc_html__( 'Generate two separate orders, one for pre-orders and one for in-stock products', 'merchant' ),
744 ),
745 'default' => 'unified_order',
746 ),
747 array(
748 'id' => 'helping_instructions_only_pre_orders',
749 'type' => 'info_block',
750 'description' => esc_html__( 'Use this mode if you want to only allow your customers to either choose pre-order products or available ones.', 'merchant' ),
751 'conditions' => array(
752 'terms' => array(
753 array(
754 'field' => 'modes', // field ID
755 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
756 'value' => 'only_pre_orders', // can be a single value or an array of string/number/int
757 ),
758 ),
759 ),
760 ),
761 array(
762 'id' => 'helping_instructions_unified_order',
763 'type' => 'info_block',
764 'description' => esc_html__( 'Use this mode if you want to treat the whole order as a pre-order if at least one product is a pre-order.', 'merchant' ),
765 'conditions' => array(
766 'terms' => array(
767 array(
768 'field' => 'modes', // field ID
769 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
770 'value' => 'unified_order', // can be a single value or an array of string/number/int
771 ),
772 ),
773 ),
774 ),
775 array(
776 'id' => 'helping_instructions_separate_order_for_pre_orders',
777 'type' => 'info_block',
778 'description' => esc_html__( 'Use this mode if you want to generate separate orders for each pre-order product.', 'merchant' ),
779 'conditions' => array(
780 'terms' => array(
781 array(
782 'field' => 'modes', // field ID
783 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
784 'value' => 'separate_order_for_pre_orders', // can be a single value or an array of string/number/int
785 ),
786 ),
787 ),
788 ),
789 array(
790 'id' => 'helping_instructions_group_pre_order_into_one_order',
791 'type' => 'info_block',
792 'description' => esc_html__( 'Use this mode if you want to generate two separate orders, one for pre-orders and one for in-stock products.', 'merchant' ),
793 'conditions' => array(
794 'terms' => array(
795 array(
796 'field' => 'modes', // field ID
797 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
798 'value' => 'group_pre_order_into_one_order', // can be a single value or an array of string/number/int
799 ),
800 ),
801 ),
802 ),
803 ),
804 ),
805 );
806