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

440 lines 16.4 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 do_action( 'merchant_admin_before_include_modules_options', Merchant_Pre_Orders::MODULE_ID );
19
20 Merchant_Admin_Options::create(
21 array(
22 'title' => esc_html__( 'Pre-order Rule', 'merchant' ),
23 'module' => Merchant_Pre_Orders::MODULE_ID,
24 'fields' => array(
25 array(
26 'id' => 'rules',
27 'type' => 'flexible_content',
28 'sorting' => true,
29 'duplicate' => true,
30 'accordion' => true,
31 'style' => Merchant_Pre_Orders::MODULE_ID . '-style default',
32 'button_label' => esc_html__( 'Add New Pre-Order', 'merchant' ),
33 'layouts' => array(
34 'rule-details' => array(
35 'title' => esc_html__( 'Campaign', 'merchant' ),
36 'title-field' => 'offer-title', // text field ID to use as title for the layout
37 'fields' => array(
38 array(
39 'id' => 'offer-title',
40 'type' => 'text',
41 'title' => esc_html__( 'Order name', 'merchant' ),
42 'default' => esc_html__( 'Custom Pre-order', 'merchant' ),
43 'desc' => esc_html__( 'Internal campaign name. This is not visible to customers.', 'merchant' ),
44 ),
45 array(
46 'id' => 'trigger_on',
47 'type' => 'select',
48 'title' => esc_html__( 'Trigger', 'merchant' ),
49 'options' => array(
50 'all' => esc_html__( 'All Products', 'merchant' ),
51 'product' => esc_html__( 'Specific Products', 'merchant' ),
52 'category' => esc_html__( 'Specific Categories', 'merchant' ),
53 'tags' => esc_html__( 'Specific Tags', 'merchant' ),
54 ),
55 'default' => 'product',
56 ),
57 array(
58 'id' => 'product_ids',
59 'type' => 'products_selector',
60 'multiple' => true,
61 'allowed_types' => array( 'simple', 'variable', 'variation', 'merchant_pro_bundle' ),
62 'desc' => esc_html__( 'Select the product(s) included in this pre-order.', 'merchant' ),
63 'condition' => array( 'trigger_on', '==', 'product' ),
64 ),
65 array(
66 'id' => 'category_slugs',
67 'type' => 'select_ajax',
68 'title' => esc_html__( 'Categories', 'merchant' ),
69 'source' => 'options',
70 'multiple' => true,
71 'options' => Merchant_Admin_Options::get_category_select2_choices(),
72 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
73 'desc' => esc_html__( 'Select the category or categories for which the products will be available for pre-order.', 'merchant' ),
74 'condition' => array( 'trigger_on', '==', 'category' ),
75 ),
76 array(
77 'id' => 'tag_slugs',
78 'type' => 'select_ajax',
79 'title' => esc_html__( 'Tags', 'merchant' ),
80 'source' => 'options',
81 'multiple' => true,
82 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
83 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
84 'desc' => esc_html__( 'Select the tag or tags for which the products will be available for pre-order.', 'merchant' ),
85 'condition' => array( 'trigger_on', '==', 'tags' ),
86 ),
87
88 array(
89 'id' => 'exclusion_enabled',
90 'type' => 'switcher',
91 'title' => esc_html__( 'Exclusion List', 'merchant' ),
92 'desc' => esc_html__( 'Select the products that will not show the offer.', 'merchant' ),
93 'default' => 0,
94 'conditions' => array(
95 'relation' => 'AND',
96 'terms' => array(
97 array(
98 'field' => 'trigger_on',
99 'operator' => 'in',
100 'value' => array( 'all', 'category', 'tags' ),
101 ),
102 ),
103 ),
104 ),
105
106 array(
107 'id' => 'excluded_products',
108 'type' => 'products_selector',
109 'title' => esc_html__( 'Exclude products', 'merchant' ),
110 'desc' => esc_html__( 'Exclude products from this discount campaign.', 'merchant' ),
111 'allowed_types' => array( 'simple', 'variable' ),
112 'multiple' => true,
113 'conditions' => array(
114 'relation' => 'AND',
115 'terms' => array(
116 array(
117 'field' => 'trigger_on',
118 'operator' => 'in',
119 'value' => array( 'all', 'category', 'tags' ),
120 ),
121 array(
122 'field' => 'exclusion_enabled',
123 'operator' => '===',
124 'value' => true,
125 ),
126 ),
127 ),
128 ),
129
130 array(
131 'id' => 'excluded_categories',
132 'type' => 'select_ajax',
133 'title' => esc_html__( 'Exclude Categories', 'merchant' ),
134 'source' => 'options',
135 'multiple' => true,
136 'options' => Merchant_Admin_Options::get_category_select2_choices(),
137 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
138 'desc' => esc_html__( 'Exclude categories from this campaign.', 'merchant' ),
139 'conditions' => array(
140 'relation' => 'AND',
141 'terms' => array(
142 array(
143 'field' => 'trigger_on',
144 'operator' => 'in',
145 'value' => array( 'all' ),
146 ),
147 array(
148 'field' => 'exclusion_enabled',
149 'operator' => '===',
150 'value' => true,
151 ),
152 ),
153 ),
154 ),
155
156 array(
157 'id' => 'excluded_tags',
158 'type' => 'select_ajax',
159 'title' => esc_html__( 'Exclude Tags', 'merchant' ),
160 'source' => 'options',
161 'multiple' => true,
162 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
163 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
164 'desc' => esc_html__( 'Exclude tags from this campaign.', 'merchant' ),
165 'conditions' => array(
166 'relation' => 'AND',
167 'terms' => array(
168 array(
169 'field' => 'trigger_on',
170 'operator' => 'in',
171 'value' => array( 'all' ),
172 ),
173 array(
174 'field' => 'exclusion_enabled',
175 'operator' => '===',
176 'value' => true,
177 ),
178 ),
179 ),
180 ),
181
182 array(
183 'id' => 'discount_toggle',
184 'type' => 'switcher',
185 'title' => __( 'Do you want to offer a discount on this pre-order?', 'merchant' ),
186 'default' => 0,
187 ),
188 array(
189 'id' => 'discount_type',
190 'type' => 'radio',
191 'title' => esc_html__( 'Discount Type', 'merchant' ),
192 'options' => array(
193 'percentage' => esc_html__( 'Percentage', 'merchant' ),
194 'fixed' => esc_html__( 'Fixed', 'merchant' ),
195 ),
196 'default' => 'percentage',
197 'conditions' => array(
198 'terms' => array(
199 array(
200 'field' => 'discount_toggle', // field ID
201 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
202 'value' => true, // can be a single value or an array of string/number/int
203 ),
204 ),
205 ),
206 ),
207 array(
208 'id' => 'discount_amount',
209 'type' => 'number',
210 'step' => 0.01,
211 'default' => 10,
212 'conditions' => array(
213 'terms' => array(
214 array(
215 'field' => 'discount_toggle', // field ID
216 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
217 'value' => true, // can be a single value or an array of string/number/int
218 ),
219 ),
220 ),
221 ),
222 array(
223 'id' => 'shipping_date',
224 'type' => 'date_time',
225 'title' => esc_html__( 'Shipping date', 'merchant' ),
226 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
227 'desc' => sprintf(
228 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
229 esc_html__( 'The times set above are in the %1$s timezone, according to your settings from %2$s.',
230 'merchant' ),
231 '<strong>' . wp_timezone_string() . '</strong>',
232 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
233 ),
234 ),
235 array(
236 'id' => 'pre_order_start',
237 'type' => 'date_time',
238 'title' => esc_html__( 'Pre-order starts at', 'merchant' ),
239 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
240 'desc' => esc_html__( 'If you want your pre-order settings to take effect immediately, leave the pre-order start empty.', 'merchant' ),
241 ),
242 array(
243 'id' => 'pre_order_end',
244 'type' => 'date_time',
245 'title' => esc_html__( 'Pre-order ends at', 'merchant' ),
246 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
247 'desc' => sprintf(
248 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
249 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.',
250 'merchant' ),
251 '<strong>' . wp_timezone_string() . '</strong>',
252 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
253 ),
254 ),
255
256 array(
257 'id' => 'user_condition',
258 'type' => 'select',
259 'title' => esc_html__( 'User Condition', 'merchant' ),
260 'options' => array(
261 'all' => esc_html__( 'All Users', 'merchant' ),
262 'customers' => esc_html__( 'Selected Users', 'merchant' ),
263 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
264 ),
265 'default' => 'all',
266 ),
267
268 array(
269 'id' => 'user_condition_roles',
270 'type' => 'select_ajax',
271 'title' => esc_html__( 'User Roles', 'merchant' ),
272 'desc' => esc_html__( 'This will limit the rule to users with these roles.', 'merchant' ),
273 'source' => 'options',
274 'multiple' => true,
275 'classes' => array( 'flex-grow' ),
276 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
277 'condition' => array( 'user_condition', '==', 'roles' ),
278 ),
279
280 array(
281 'id' => 'user_condition_users',
282 'type' => 'select_ajax',
283 'title' => esc_html__( 'Users', 'merchant' ),
284 'desc' => esc_html__( 'This will limit the rule to the selected customers.', 'merchant' ),
285 'source' => 'user',
286 'multiple' => true,
287 'classes' => array( 'flex-grow' ),
288 'condition' => array( 'user_condition', '==', 'customers' ),
289 ),
290 array(
291 'id' => 'button_text',
292 'type' => 'text',
293 'title' => esc_html__( 'Button text', 'merchant' ),
294 'default' => esc_html__( 'Pre-Order', 'merchant' ),
295 ),
296
297 array(
298 'id' => 'additional_text',
299 'type' => 'text',
300 'title' => esc_html__( 'Additional information', 'merchant' ),
301 'default' => esc_html__( 'Ships on {date}', 'merchant' ),
302 ),
303
304 array(
305 'id' => 'placement',
306 'type' => 'radio',
307 'title' => esc_html__( 'Placement', 'merchant' ),
308 'options' => array(
309 'before' => esc_html__( 'Before Button', 'merchant' ),
310 'after' => esc_html__( 'After Button', 'merchant' ),
311 ),
312 'default' => 'before',
313 ),
314 array(
315 'id' => 'cart_label_text',
316 'type' => 'text',
317 'title' => esc_html__( 'Label text on cart', 'merchant' ),
318 'default' => esc_html__( 'Ships on', 'merchant' ),
319 ),
320 array(
321 'id' => 'text-color',
322 'type' => 'color',
323 'title' => esc_html__( 'Button text color', 'merchant' ),
324 'default' => '#FFF',
325 ),
326
327 array(
328 'id' => 'text-hover-color',
329 'type' => 'color',
330 'title' => esc_html__( 'Button text color hover', 'merchant' ),
331 'default' => '#FFF',
332 ),
333
334 array(
335 'id' => 'border-color',
336 'type' => 'color',
337 'title' => esc_html__( 'Button border color', 'merchant' ),
338 'default' => '#212121',
339 ),
340
341 array(
342 'id' => 'border-hover-color',
343 'type' => 'color',
344 'title' => esc_html__( 'Button border color hover', 'merchant' ),
345 'default' => '#414141',
346 ),
347
348 array(
349 'id' => 'background-color',
350 'type' => 'color',
351 'title' => esc_html__( 'Button background color', 'merchant' ),
352 'default' => '#212121',
353 ),
354
355 array(
356 'id' => 'background-hover-color',
357 'type' => 'color',
358 'title' => esc_html__( 'Button background color hover', 'merchant' ),
359 'default' => '#414141',
360 ),
361 ),
362 ),
363 ),
364 'default' => array(
365 array(
366 'layout' => 'rule-details',
367 ),
368 ),
369 ),
370 array(
371 'id' => 'modes',
372 'type' => 'select',
373 'title' => esc_html__( 'Pre-order Modes', 'merchant' ),
374 'options' => array(
375 'only_pre_orders' => esc_html__( 'Allow only pre-orders', 'merchant' ),
376 'unified_order' => esc_html__( 'Treat the whole order as pre-order', 'merchant' ),
377 // 'separate_order_for_pre_orders' => esc_html__( 'Generate separate orders for each pre-order product', 'merchant' ),
378 // 'group_pre_order_into_one_order' => esc_html__( 'Generate two separate orders, one for pre-orders and one for in-stock products', 'merchant' ),
379 ),
380 'default' => 'unified_order',
381 ),
382 array(
383 'id' => 'helping_instructions_only_pre_orders',
384 'type' => 'info_block',
385 'description' => esc_html__( 'Use this mode if you want to only allow your customers to either choose pre-order products or available ones.', 'merchant' ),
386 'conditions' => array(
387 'terms' => array(
388 array(
389 'field' => 'modes', // field ID
390 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
391 'value' => 'only_pre_orders', // can be a single value or an array of string/number/int
392 ),
393 ),
394 ),
395 ),
396 array(
397 'id' => 'helping_instructions_unified_order',
398 'type' => 'info_block',
399 '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' ),
400 'conditions' => array(
401 'terms' => array(
402 array(
403 'field' => 'modes', // field ID
404 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
405 'value' => 'unified_order', // can be a single value or an array of string/number/int
406 ),
407 ),
408 ),
409 ),
410 array(
411 'id' => 'helping_instructions_separate_order_for_pre_orders',
412 'type' => 'info_block',
413 'description' => esc_html__( 'Use this mode if you want to generate separate orders for each pre-order product.', 'merchant' ),
414 'conditions' => array(
415 'terms' => array(
416 array(
417 'field' => 'modes', // field ID
418 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
419 'value' => 'separate_order_for_pre_orders', // can be a single value or an array of string/number/int
420 ),
421 ),
422 ),
423 ),
424 array(
425 'id' => 'helping_instructions_group_pre_order_into_one_order',
426 'type' => 'info_block',
427 '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' ),
428 'conditions' => array(
429 'terms' => array(
430 array(
431 'field' => 'modes', // field ID
432 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
433 'value' => 'group_pre_order_into_one_order', // can be a single value or an array of string/number/int
434 ),
435 ),
436 ),
437 ),
438 ),
439 )
440 );