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 / buy-now / 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/buy-now/admin/options.php

864 lines 31.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Buy Now — Admin Options.
4 *
5 * Defines the campaign-based flexible_content repeater and global settings sections.
6 *
7 * @package Merchant
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly
12 }
13
14 // Campaign icons choices.
15 $buy_now_icon_choices = Merchant_Buy_Now_Icons::get_available_icons();
16
17 if ( ! function_exists( 'merchant_buy_now_get_popup_toggle_field' ) ) {
18 /**
19 * Return the popup toggle field based on Pro/module availability.
20 *
21 * - Free only: info notice with upgrade CTA.
22 * - Pro installed, popup inactive: info notice with activation link.
23 * - Pro + popup active: switcher toggle.
24 *
25 * @return array<string, mixed>
26 */
27 function merchant_buy_now_get_popup_toggle_field(): array {
28 if ( ! defined( 'MERCHANT_PRO_VERSION' ) ) {
29 return array(
30 'id' => 'show_cart_popup_info',
31 'type' => 'info',
32 'content' => esc_html__( 'Show the Added to Cart Popup instead of redirecting immediately. This feature requires Merchant Pro.', 'merchant' ),
33 );
34 }
35
36 if ( ! Merchant_Modules::is_module_active( 'added-to-cart-popup' ) ) {
37 $activation_url = admin_url( 'admin.php?page=merchant&module=added-to-cart-popup' );
38
39 return array(
40 'id' => 'show_cart_popup_info',
41 'type' => 'info',
42 'content' => sprintf(
43 /* translators: %s: module activation link */
44 esc_html__( 'To show a popup before redirecting, activate the %s module first.', 'merchant' ),
45 '<a href="' . esc_url( $activation_url ) . '">' . esc_html__( 'Added to Cart Popup', 'merchant' ) . '</a>'
46 ),
47 );
48 }
49
50 return array(
51 'id' => 'show_cart_popup',
52 'type' => 'switcher',
53 'title' => esc_html__( 'Show Added to Cart Popup', 'merchant' ),
54 'desc' => esc_html__( 'Display the Added to Cart Popup before redirecting to checkout.', 'merchant' ),
55 'default' => 0,
56 );
57 }
58 }
59
60 /**
61 * Campaigns
62 */
63
64 return array(
65 array(
66 'module' => 'buy-now',
67 'title' => esc_html__( 'Campaigns', 'merchant' ),
68 'fields' => array(
69 array(
70 'id' => 'campaigns',
71 'type' => 'flexible_content',
72 'sorting' => true,
73 'accordion' => true,
74 'duplicate' => true,
75 'style' => 'buy-now-style default',
76 'button_label' => esc_html__( 'Add New Campaign', 'merchant' ),
77 'layouts' => array(
78 'campaign-details' => array(
79 'title' => esc_html__( 'Campaign', 'merchant' ),
80 'title-field' => 'offer-title',
81 'status-field' => 'campaign_status',
82 'fields' => array(
83
84 // ── Campaign Meta ─────────────────────────────────────
85 array(
86 'id' => 'campaign_status',
87 'type' => 'select',
88 'title' => esc_html__( 'Status', 'merchant' ),
89 'options' => array(
90 'active' => esc_html__( 'Active', 'merchant' ),
91 'inactive' => esc_html__( 'Inactive', 'merchant' ),
92 ),
93 'default' => 'active',
94 'ai_meta' => array(
95 'usage_hint' => 'Controls whether this campaign is active or inactive. Set to active to enable, inactive to disable.',
96 ),
97 ),
98 array(
99 'id' => 'offer-title',
100 'type' => 'text',
101 'title' => esc_html__( 'Campaign name', 'merchant' ),
102 'default' => esc_html__( 'Campaign', 'merchant' ),
103 ),
104
105 // ── Product Targeting ─────────────────────────────────
106 array(
107 'id' => 'rules_to_display',
108 'type' => 'select',
109 'title' => esc_html__( 'Apply to', 'merchant' ),
110 'options' => array(
111 'all' => esc_html__( 'All Products', 'merchant' ),
112 'products' => esc_html__( 'Specific Products', 'merchant' ),
113 'categories' => esc_html__( 'Specific Categories', 'merchant' ),
114 'tags' => esc_html__( 'Specific Tags', 'merchant' ),
115 'brands' => esc_html__( 'Specific Brands', 'merchant' ),
116 ),
117 'default' => 'all',
118 'ai_meta' => array(
119 'semantic_group' => 'product_targeting',
120 'usage_hint' => 'Controls which products this campaign applies to. Set this BEFORE setting product_ids, category_slugs, tag_slugs, or brand_slugs — those fields are conditional on this value.',
121 ),
122 ),
123 array(
124 'id' => 'product_ids',
125 'type' => 'products_selector',
126 'title' => esc_html__( 'Products', 'merchant' ),
127 'multiple' => true,
128 'desc' => esc_html__( 'Select products that will show the Buy Now button.', 'merchant' ),
129 'condition' => array( 'rules_to_display', '==', 'products' ),
130 'allowed_types' => array( 'simple', 'variable', 'variation' ),
131 'ai_meta' => array(
132 'entity' => 'product',
133 'reference_type' => 'static',
134 'value_format' => 'product_id',
135 'semantic_group' => 'product_targeting',
136 'abstraction_level' => 1,
137 'usage_hint' => 'List of product IDs this campaign targets. Only used when rules_to_display is set to products.',
138 ),
139 ),
140 array(
141 'id' => 'category_slugs',
142 'type' => 'select_ajax',
143 'title' => esc_html__( 'Categories', 'merchant' ),
144 'source' => 'options',
145 'multiple' => true,
146 'options' => Merchant_Admin_Options::get_category_select2_choices(),
147 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
148 'desc' => esc_html__( 'Select product categories that will show the Buy Now button.', 'merchant' ),
149 'condition' => array( 'rules_to_display', '==', 'categories' ),
150 'ai_meta' => array(
151 'entity' => 'category',
152 'reference_type' => 'dynamic',
153 'taxonomy' => 'product_cat',
154 'value_format' => 'slug',
155 'semantic_group' => 'product_targeting',
156 'abstraction_level' => 3,
157 'usage_hint' => 'Category slugs this campaign targets. Only used when rules_to_display is set to categories.',
158 ),
159 ),
160 array(
161 'id' => 'tag_slugs',
162 'type' => 'select_ajax',
163 'title' => esc_html__( 'Tags', 'merchant' ),
164 'source' => 'options',
165 'multiple' => true,
166 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
167 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
168 'desc' => esc_html__( 'Select product tags that will show the Buy Now button.', 'merchant' ),
169 'condition' => array( 'rules_to_display', '==', 'tags' ),
170 'ai_meta' => array(
171 'entity' => 'tag',
172 'reference_type' => 'dynamic',
173 'taxonomy' => 'product_tag',
174 'value_format' => 'slug',
175 'semantic_group' => 'product_targeting',
176 'abstraction_level' => 2,
177 'usage_hint' => 'Tag slugs this campaign targets. Only used when rules_to_display is set to tags.',
178 ),
179 ),
180 array(
181 'id' => 'brand_slugs',
182 'type' => 'select_ajax',
183 'title' => esc_html__( 'Brands', 'merchant' ),
184 'source' => 'options',
185 'multiple' => true,
186 'options' => Merchant_Admin_Options::get_brand_select2_choices(),
187 'placeholder' => esc_html__( 'Select brands', 'merchant' ),
188 'desc' => esc_html__( 'Select product brands that will show the Buy Now button.', 'merchant' ),
189 'condition' => array( 'rules_to_display', '==', 'brands' ),
190 'ai_meta' => array(
191 'entity' => 'brand',
192 'reference_type' => 'dynamic',
193 'taxonomy' => 'product_brand',
194 'value_format' => 'slug',
195 'semantic_group' => 'product_targeting',
196 'abstraction_level' => 4,
197 'usage_hint' => 'Brand slugs this campaign targets. Only used when rules_to_display is set to brands.',
198 ),
199 ),
200
201 // ── Product Exclusions ────────────────────────────────
202 array(
203 'id' => 'exclude_products_toggle',
204 'type' => 'switcher',
205 'title' => esc_html__( 'Exclude products', 'merchant' ),
206 'default' => 0,
207 'conditions' => array(
208 'relation' => 'AND',
209 'terms' => array(
210 array(
211 'field' => 'rules_to_display',
212 'operator' => 'in',
213 'value' => array( 'all', 'categories', 'tags', 'brands' ),
214 ),
215 ),
216 ),
217 'ai_meta' => array(
218 'toggle_for' => 'excluded_products',
219 'semantic_group' => 'product_exclusion',
220 'usage_hint' => 'Enable this to reveal the excluded_products field. Must be true before setting excluded_products.',
221 ),
222 ),
223 array(
224 'id' => 'excluded_products',
225 'type' => 'products_selector',
226 'title' => esc_html__( 'Excluded Products', 'merchant' ),
227 'multiple' => true,
228 'desc' => esc_html__( 'Select products to exclude from this campaign.', 'merchant' ),
229 'allowed_types' => array( 'simple', 'variable', 'variation' ),
230 'ai_meta' => array(
231 'entity' => 'product',
232 'reference_type' => 'static',
233 'value_format' => 'product_id',
234 'semantic_group' => 'product_exclusion',
235 'abstraction_level' => 1,
236 'toggled_by' => 'exclude_products_toggle',
237 'usage_hint' => 'Products excluded from this campaign. Requires exclude_products_toggle to be enabled.',
238 ),
239 'conditions' => array(
240 'relation' => 'AND',
241 'terms' => array(
242 array(
243 'field' => 'rules_to_display',
244 'operator' => 'in',
245 'value' => array( 'all', 'categories', 'tags', 'brands' ),
246 ),
247 array(
248 'field' => 'exclude_products_toggle',
249 'operator' => '===',
250 'value' => true,
251 ),
252 ),
253 ),
254 ),
255 array(
256 'id' => 'exclude_categories_toggle',
257 'type' => 'switcher',
258 'title' => esc_html__( 'Exclude categories', 'merchant' ),
259 'default' => 0,
260 'conditions' => array(
261 'relation' => 'AND',
262 'terms' => array(
263 array(
264 'field' => 'rules_to_display',
265 'operator' => 'in',
266 'value' => array( 'all', 'products', 'tags', 'brands' ),
267 ),
268 ),
269 ),
270 'ai_meta' => array(
271 'toggle_for' => 'excluded_categories',
272 'semantic_group' => 'product_exclusion',
273 'usage_hint' => 'Enable this to reveal the excluded_categories field. Must be true before setting excluded_categories.',
274 ),
275 ),
276 array(
277 'id' => 'excluded_categories',
278 'type' => 'select_ajax',
279 'title' => esc_html__( 'Excluded Categories', 'merchant' ),
280 'source' => 'options',
281 'multiple' => true,
282 'options' => Merchant_Admin_Options::get_category_select2_choices(),
283 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
284 'ai_meta' => array(
285 'entity' => 'category',
286 'reference_type' => 'dynamic',
287 'taxonomy' => 'product_cat',
288 'value_format' => 'slug',
289 'semantic_group' => 'product_exclusion',
290 'abstraction_level' => 3,
291 'toggled_by' => 'exclude_categories_toggle',
292 'usage_hint' => 'Categories excluded from this campaign. Requires exclude_categories_toggle to be enabled.',
293 ),
294 'conditions' => array(
295 'relation' => 'AND',
296 'terms' => array(
297 array(
298 'field' => 'rules_to_display',
299 'operator' => 'in',
300 'value' => array( 'all', 'products', 'tags', 'brands' ),
301 ),
302 array(
303 'field' => 'exclude_categories_toggle',
304 'operator' => '===',
305 'value' => true,
306 ),
307 ),
308 ),
309 ),
310 array(
311 'id' => 'exclude_tags_toggle',
312 'type' => 'switcher',
313 'title' => esc_html__( 'Exclude tags', 'merchant' ),
314 'default' => 0,
315 'conditions' => array(
316 'relation' => 'AND',
317 'terms' => array(
318 array(
319 'field' => 'rules_to_display',
320 'operator' => 'in',
321 'value' => array( 'all', 'products', 'categories', 'brands' ),
322 ),
323 ),
324 ),
325 'ai_meta' => array(
326 'toggle_for' => 'excluded_tags',
327 'semantic_group' => 'product_exclusion',
328 'usage_hint' => 'Enable this to reveal the excluded_tags field. Must be true before setting excluded_tags.',
329 ),
330 ),
331 array(
332 'id' => 'excluded_tags',
333 'type' => 'select_ajax',
334 'title' => esc_html__( 'Excluded Tags', 'merchant' ),
335 'source' => 'options',
336 'multiple' => true,
337 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
338 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
339 'ai_meta' => array(
340 'entity' => 'tag',
341 'reference_type' => 'dynamic',
342 'taxonomy' => 'product_tag',
343 'value_format' => 'slug',
344 'semantic_group' => 'product_exclusion',
345 'abstraction_level' => 2,
346 'toggled_by' => 'exclude_tags_toggle',
347 'usage_hint' => 'Tags excluded from this campaign. Requires exclude_tags_toggle to be enabled.',
348 ),
349 'conditions' => array(
350 'relation' => 'AND',
351 'terms' => array(
352 array(
353 'field' => 'rules_to_display',
354 'operator' => 'in',
355 'value' => array( 'all', 'products', 'categories', 'brands' ),
356 ),
357 array(
358 'field' => 'exclude_tags_toggle',
359 'operator' => '===',
360 'value' => true,
361 ),
362 ),
363 ),
364 ),
365
366 // ── User Conditions ───────────────────────────────────
367 array(
368 'id' => 'user_condition',
369 'type' => 'select',
370 'title' => esc_html__( 'User Condition', 'merchant' ),
371 'desc' => esc_html__( 'Choose which users can see the Buy Now button for this campaign.', 'merchant' ),
372 'options' => array(
373 'all' => esc_html__( 'All Users', 'merchant' ),
374 'customers' => esc_html__( 'Selected Users', 'merchant' ),
375 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
376 ),
377 'default' => 'all',
378 'ai_meta' => array(
379 'semantic_group' => 'user_targeting',
380 'usage_hint' => 'Controls which users see this campaign. Set to all, customers (specific users), or roles. Set this BEFORE setting user_condition_users or user_condition_roles.',
381 ),
382 ),
383 array(
384 'id' => 'user_condition_roles',
385 'type' => 'select_ajax',
386 'title' => esc_html__( 'User Roles', 'merchant' ),
387 'desc' => esc_html__( 'This will limit the campaign to users with these roles.', 'merchant' ),
388 'source' => 'options',
389 'multiple' => true,
390 'classes' => array( 'flex-grow' ),
391 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
392 'condition' => array( 'user_condition', '==', 'roles' ),
393 'ai_meta' => array(
394 'entity' => 'role',
395 'reference_type' => 'dynamic',
396 'value_format' => 'role_slug',
397 'semantic_group' => 'user_targeting',
398 'abstraction_level' => 2,
399 'usage_hint' => 'Roles allowed to see this campaign. Only used when user_condition is set to roles.',
400 ),
401 ),
402 array(
403 'id' => 'user_condition_users',
404 'type' => 'select_ajax',
405 'title' => esc_html__( 'Users', 'merchant' ),
406 'desc' => esc_html__( 'This will limit the campaign to the selected customers.', 'merchant' ),
407 'source' => 'user',
408 'multiple' => true,
409 'classes' => array( 'flex-grow' ),
410 'condition' => array( 'user_condition', '==', 'customers' ),
411 'ai_meta' => array(
412 'entity' => 'user',
413 'reference_type' => 'static',
414 'value_format' => 'user_id',
415 'semantic_group' => 'user_targeting',
416 'abstraction_level' => 1,
417 'usage_hint' => 'Specific user IDs allowed to see this campaign. Only used when user_condition is set to customers.',
418 ),
419 ),
420 array(
421 'id' => 'user_exclusion_enabled',
422 'type' => 'switcher',
423 'title' => esc_html__( 'Exclusion List', 'merchant' ),
424 'desc' => esc_html__( 'Exclude specific users or roles from this campaign.', 'merchant' ),
425 'default' => 0,
426 'conditions' => array(
427 'relation' => 'AND',
428 'terms' => array(
429 array(
430 'field' => 'user_condition',
431 'operator' => 'in',
432 'value' => array( 'all', 'roles' ),
433 ),
434 ),
435 ),
436 'ai_meta' => array(
437 'toggle_for' => 'exclude_roles',
438 'semantic_group' => 'user_exclusion',
439 'usage_hint' => 'Enable this to reveal exclude_roles and exclude_users fields.',
440 ),
441 ),
442 array(
443 'id' => 'exclude_roles',
444 'type' => 'select_ajax',
445 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
446 'desc' => esc_html__( 'Users with these roles will not see the Buy Now button.', 'merchant' ),
447 'source' => 'options',
448 'multiple' => true,
449 'classes' => array( 'flex-grow' ),
450 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
451 'ai_meta' => array(
452 'entity' => 'role',
453 'reference_type' => 'dynamic',
454 'value_format' => 'role_slug',
455 'semantic_group' => 'user_exclusion',
456 'abstraction_level' => 2,
457 'toggled_by' => 'user_exclusion_enabled',
458 'usage_hint' => 'Roles excluded from seeing this campaign. Requires user_exclusion_enabled to be true.',
459 ),
460 'conditions' => array(
461 'relation' => 'AND',
462 'terms' => array(
463 array(
464 'field' => 'user_condition',
465 'operator' => 'in',
466 'value' => array( 'all' ),
467 ),
468 array(
469 'field' => 'user_exclusion_enabled',
470 'operator' => '===',
471 'value' => true,
472 ),
473 ),
474 ),
475 ),
476 array(
477 'id' => 'exclude_users',
478 'type' => 'select_ajax',
479 'title' => esc_html__( 'Exclude Users', 'merchant' ),
480 'desc' => esc_html__( 'These users will not see the Buy Now button.', 'merchant' ),
481 'source' => 'user',
482 'multiple' => true,
483 'classes' => array( 'flex-grow' ),
484 'ai_meta' => array(
485 'entity' => 'user',
486 'reference_type' => 'static',
487 'value_format' => 'user_id',
488 'semantic_group' => 'user_exclusion',
489 'abstraction_level' => 1,
490 'toggled_by' => 'user_exclusion_enabled',
491 'usage_hint' => 'Specific users excluded from seeing this campaign. Requires user_exclusion_enabled to be true.',
492 ),
493 'conditions' => array(
494 'relation' => 'AND',
495 'terms' => array(
496 array(
497 'field' => 'user_condition',
498 'operator' => 'in',
499 'value' => array( 'all', 'roles' ),
500 ),
501 array(
502 'field' => 'user_exclusion_enabled',
503 'operator' => '===',
504 'value' => true,
505 ),
506 ),
507 ),
508 ),
509
510 // ── Button Behavior ───────────────────────────────────
511 array(
512 'id' => 'cart_action',
513 'type' => 'select',
514 'title' => esc_html__( 'Cart Action', 'merchant' ),
515 'desc' => esc_html__( 'What to do with existing cart items when Buy Now is clicked.', 'merchant' ),
516 'options' => array(
517 'keep' => esc_html__( 'Keep existing cart items', 'merchant' ),
518 'clear' => esc_html__( 'Clear cart before adding product', 'merchant' ),
519 ),
520 'default' => 'keep',
521 'ai_meta' => array(
522 'semantic_group' => 'offer_rules',
523 'usage_hint' => 'Determines whether existing cart items are kept or cleared when the Buy Now button is clicked.',
524 ),
525 ),
526 array(
527 'id' => 'redirect_to',
528 'type' => 'select',
529 'title' => esc_html__( 'Redirect After Purchase', 'merchant' ),
530 'options' => array(
531 'checkout' => esc_html__( 'Checkout page', 'merchant' ),
532 'custom_url' => esc_html__( 'Custom URL', 'merchant' ),
533 ),
534 'default' => 'checkout',
535 'ai_meta' => array(
536 'semantic_group' => 'offer_rules',
537 'usage_hint' => 'Where the user is redirected after clicking Buy Now. Set to custom_url to use custom_redirect_url.',
538 ),
539 ),
540 array(
541 'id' => 'custom_redirect_url',
542 'type' => 'text',
543 'title' => esc_html__( 'Custom Redirect URL', 'merchant' ),
544 'desc' => esc_html__( 'Enter the full URL to redirect to after adding to cart.', 'merchant' ),
545 'default' => '',
546 'condition' => array( 'redirect_to', '==', 'custom_url' ),
547 ),
548
549 // ── Button Design ─────────────────────────────────────
550 array(
551 'id' => 'button_text',
552 'type' => 'text',
553 'title' => esc_html__( 'Button text', 'merchant' ),
554 'default' => esc_html__( 'Buy Now', 'merchant' ),
555 ),
556 array(
557 'id' => 'button_icon',
558 'type' => 'select',
559 'title' => esc_html__( 'Button icon', 'merchant' ),
560 'options' => $buy_now_icon_choices,
561 'default' => 'none',
562 ),
563 array(
564 'id' => 'button_icon_position',
565 'type' => 'select',
566 'title' => esc_html__( 'Icon position', 'merchant' ),
567 'options' => array(
568 'before' => esc_html__( 'Before text', 'merchant' ),
569 'after' => esc_html__( 'After text', 'merchant' ),
570 ),
571 'default' => 'before',
572 'conditions' => array(
573 'relation' => 'AND',
574 'terms' => array(
575 array(
576 'field' => 'button_icon',
577 'operator' => 'in',
578 'value' => array( 'cart', 'lightning', 'arrow', 'custom' ),
579 ),
580 ),
581 ),
582 ),
583 array(
584 'id' => 'button_icon_svg',
585 'type' => 'textarea',
586 'title' => esc_html__( 'Custom SVG markup', 'merchant' ),
587 'desc' => esc_html__( 'Paste your custom SVG icon markup here.', 'merchant' ),
588 'default' => '',
589 'condition' => array( 'button_icon', '==', 'custom' ),
590 'sanitize' => 'merchant_sanitize_svg',
591 ),
592
593 // ── Added to Cart Popup Integration ──────────────────
594 merchant_buy_now_get_popup_toggle_field(),
595
596 ),
597 ),
598 ),
599 ),
600 ),
601 ),
602 array(
603 'title' => esc_html__( 'Button Style', 'merchant' ),
604 'module' => 'buy-now',
605 'fields' => array(
606
607 // Customize The Button or Inherit from Themes.
608 array(
609 'id' => 'customize-button',
610 'type' => 'switcher',
611 'title' => esc_html__( 'Customize Button', 'merchant' ),
612 'default' => 1,
613 ),
614
615 array(
616 'id' => 'text-color',
617 'type' => 'color',
618 'title' => esc_html__( 'Button text color', 'merchant' ),
619 'default' => '#ffffff',
620 'condition' => array( 'customize-button', '==', '1' ),
621 ),
622
623 array(
624 'id' => 'text-hover-color',
625 'type' => 'color',
626 'title' => esc_html__( 'Button text color hover', 'merchant' ),
627 'default' => '#ffffff',
628 'condition' => array( 'customize-button', '==', '1' ),
629 ),
630
631 array(
632 'id' => 'border-color',
633 'type' => 'color',
634 'title' => esc_html__( 'Button border color', 'merchant' ),
635 'default' => '#212121',
636 'condition' => array( 'customize-button', '==', '1' ),
637 ),
638
639 array(
640 'id' => 'border-hover-color',
641 'type' => 'color',
642 'title' => esc_html__( 'Button border color hover', 'merchant' ),
643 'default' => '#414141',
644 'condition' => array( 'customize-button', '==', '1' ),
645 ),
646
647 array(
648 'id' => 'background-color',
649 'type' => 'color',
650 'title' => esc_html__( 'Button background color', 'merchant' ),
651 'default' => '#212121',
652 'condition' => array( 'customize-button', '==', '1' ),
653 ),
654
655 array(
656 'id' => 'background-hover-color',
657 'type' => 'color',
658 'title' => esc_html__( 'Button background color hover', 'merchant' ),
659 'default' => '#414141',
660 'condition' => array( 'customize-button', '==', '1' ),
661 ),
662
663 array(
664 'id' => 'button-size',
665 'type' => 'select',
666 'title' => esc_html__( 'Button size', 'merchant' ),
667 'options' => array(
668 'small' => esc_html__( 'Small', 'merchant' ),
669 'medium' => esc_html__( 'Medium', 'merchant' ),
670 'large' => esc_html__( 'Large', 'merchant' ),
671 'custom' => esc_html__( 'Custom', 'merchant' ),
672 ),
673 'default' => 'medium',
674 'condition' => array( 'customize-button', '==', '1' ),
675 ),
676
677 array(
678 'id' => 'font-size',
679 'type' => 'range',
680 'title' => esc_html__( 'Font size', 'merchant' ),
681 'min' => 1,
682 'max' => 100,
683 'step' => 1,
684 'default' => 16,
685 'unit' => 'px',
686 'condition' => array( 'customize-button', '==', '1' ),
687 ),
688
689 array(
690 'id' => 'margin-top',
691 'type' => 'range',
692 'title' => esc_html__( 'Margin top', 'merchant' ),
693 'min' => 0,
694 'max' => 100,
695 'step' => 1,
696 'default' => 10,
697 'unit' => 'px',
698 'conditions' => array(
699 'terms' => array(
700 array(
701 'field' => 'customize-button',
702 'operator' => '===',
703 'value' => true,
704 ),
705 ),
706 ),
707 ),
708
709 array(
710 'id' => 'margin-bottom',
711 'type' => 'range',
712 'title' => esc_html__( 'Margin bottom', 'merchant' ),
713 'min' => 0,
714 'max' => 100,
715 'step' => 1,
716 'default' => 10,
717 'unit' => 'px',
718 'conditions' => array(
719 'terms' => array(
720 array(
721 'field' => 'customize-button',
722 'operator' => '===',
723 'value' => true,
724 ),
725 ),
726 ),
727 ),
728
729 array(
730 'id' => 'padding_top_bottom',
731 'type' => 'range',
732 'title' => esc_html__( 'Padding Top/Bottom', 'merchant' ),
733 'min' => 0,
734 'max' => 100,
735 'step' => 1,
736 'default' => 12,
737 'unit' => 'px',
738 'conditions' => array(
739 'terms' => array(
740 array(
741 'field' => 'customize-button',
742 'operator' => '===',
743 'value' => true,
744 ),
745 ),
746 ),
747 ),
748
749 array(
750 'id' => 'padding_left_right',
751 'type' => 'range',
752 'title' => esc_html__( 'Padding Left/Right', 'merchant' ),
753 'min' => 0,
754 'max' => 100,
755 'step' => 1,
756 'default' => 24,
757 'unit' => 'px',
758 'conditions' => array(
759 'terms' => array(
760 array(
761 'field' => 'customize-button',
762 'operator' => '===',
763 'value' => true,
764 ),
765 ),
766 ),
767 ),
768
769 array(
770 'id' => 'border-radius',
771 'type' => 'range',
772 'title' => esc_html__( 'Border radius', 'merchant' ),
773 'min' => 0,
774 'max' => 9999,
775 'step' => 1,
776 'unit' => 'px',
777 'default' => 0,
778 'condition' => array( 'customize-button', '==', '1' ),
779 ),
780
781 ),
782 ),
783 array(
784 'module' => 'buy-now',
785 'title' => esc_html__( 'Display Settings', 'merchant' ),
786 'fields' => array(
787
788 array(
789 'id' => 'display-archive',
790 'type' => 'checkbox',
791 'label' => __( 'Show on product archive', 'merchant' ),
792 'default' => 1,
793 ),
794 array(
795 'id' => 'display-product',
796 'type' => 'checkbox',
797 'label' => __( 'Show on single product page', 'merchant' ),
798 'default' => 1,
799 ),
800 array(
801 'id' => 'display-upsell-related',
802 'type' => 'checkbox',
803 'label' => __( 'Show on upsell and related products', 'merchant' ),
804 'default' => 1,
805 ),
806
807 // Loading position/priority on shop archive.
808 array(
809 'id' => 'hook-order-shop-archive',
810 'type' => 'hook_select',
811 'title' => __( 'Loading position and priority on shop archive', 'merchant' ),
812 'options' => array(
813 'woocommerce_before_shop_loop_item' => __( 'Before shop loop item', 'merchant' ),
814 'woocommerce_before_shop_loop_item_title' => __( 'Before shop loop item title', 'merchant' ),
815 'woocommerce_shop_loop_item_title' => __( 'Shop loop item title', 'merchant' ),
816 'woocommerce_after_shop_loop_item_title' => __( 'After shop loop item title', 'merchant' ),
817 'woocommerce_after_shop_loop_item' => __( 'After shop loop item', 'merchant' ),
818 ),
819 'min' => -999,
820 'max' => 999,
821 'step' => 1,
822 'unit' => '',
823 'order' => true,
824 'default' => array(
825 'hook_name' => 'woocommerce_after_shop_loop_item',
826 'hook_priority' => 10,
827 ),
828 ),
829 array(
830 'id' => 'hook-order-shop-archive_info',
831 'type' => 'info',
832 'content' => esc_html__( 'This is a developer level feature. The buy now button module is "hooked" into a specific location on the shop archive pages. Themes and other plugins might also add additional elements to the same location. By modifying the loading postiion and priority, you have the ability to customize the placement of this element on that particular location. A lower number = a higher priority, so the module will appear higher on the page.', 'merchant' ),
833 ),
834
835 // Loading position/priority on single product.
836 array(
837 'id' => 'hook-order-single-product',
838 'type' => 'hook_select',
839 'title' => __( 'Loading position and priority on single product', 'merchant' ),
840 'options' => array(
841 'woocommerce_before_add_to_cart_button' => __( 'Before add to cart button', 'merchant' ),
842 'woocommerce_after_add_to_cart_button' => __( 'After add to cart button', 'merchant' ),
843 'woocommerce_before_add_to_cart_quantity' => __( 'Before add to cart quantity', 'merchant' ),
844 'woocommerce_after_add_to_cart_quantity' => __( 'After add to cart quantity', 'merchant' ),
845 ),
846 'min' => -999,
847 'max' => 999,
848 'step' => 1,
849 'unit' => '',
850 'order' => true,
851 'default' => array(
852 'hook_name' => 'woocommerce_after_add_to_cart_button',
853 'hook_priority' => 10,
854 ),
855 ),
856 array(
857 'id' => 'hook-order-single-product_info',
858 'type' => 'info',
859 'content' => esc_html__( 'This is a developer level feature. The buy now button module is "hooked" into a specific location on the single product pages. Themes and other plugins might also add additional elements to the same location. By modifying the loading postiion and priority, you have the ability to customize the placement of this element on that particular location. A lower number = a higher priority, so the module will appear higher on the page.', 'merchant' ),
860 ),
861 ),
862 ),
863 );
864