| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Wait List Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
// Form Settings |
| 14 |
Merchant_Admin_Options::create( array( |
| 15 |
'title' => esc_html__( 'Form Settings', 'merchant' ), |
| 16 |
'module' => Merchant_Wait_List::MODULE_ID, |
| 17 |
'fields' => array( |
| 18 |
|
| 19 |
array( |
| 20 |
'id' => 'display_on_backorders', |
| 21 |
'type' => 'switcher', |
| 22 |
'title' => esc_html__( 'Display on backorders?', 'merchant' ), |
| 23 |
), |
| 24 |
|
| 25 |
array( |
| 26 |
'id' => 'form_title', |
| 27 |
'type' => 'text', |
| 28 |
'title' => esc_html__( 'Form title', 'merchant' ), |
| 29 |
'default' => __( 'New stock is coming! Email me when this item is back in stock', 'merchant' ), |
| 30 |
), |
| 31 |
|
| 32 |
array( |
| 33 |
'id' => 'form_email_label', |
| 34 |
'type' => 'text', |
| 35 |
'title' => esc_html__( 'Form email label', 'merchant' ), |
| 36 |
'default' => __( 'Your Email Address', 'merchant' ), |
| 37 |
), |
| 38 |
|
| 39 |
array( |
| 40 |
'id' => 'form_button_text', |
| 41 |
'type' => 'text', |
| 42 |
'title' => esc_html__( 'Form button text', 'merchant' ), |
| 43 |
'default' => __( 'Notify Me', 'merchant' ), |
| 44 |
), |
| 45 |
|
| 46 |
array( |
| 47 |
'id' => 'form_success_message', |
| 48 |
'type' => 'textarea', |
| 49 |
'title' => esc_html__( 'Form success message', 'merchant' ), |
| 50 |
'default' => __( 'You have been successfully added to our stock waitlist. As soon as new stock becomes available, we will notify you via email.', 'merchant' ), |
| 51 |
'desc' => esc_html__( 'The message that will show after form submission.', 'merchant' ), |
| 52 |
), |
| 53 |
), |
| 54 |
) ); |
| 55 |
|
| 56 |
Merchant_Admin_Options::create( array( |
| 57 |
'title' => esc_html__( 'Email Settings', 'merchant' ), |
| 58 |
'module' => Merchant_Wait_List::MODULE_ID, |
| 59 |
'fields' => array( |
| 60 |
|
| 61 |
array( |
| 62 |
'id' => 'email_new_subscriber', |
| 63 |
'type' => 'textarea', |
| 64 |
'title' => esc_html__( 'Email new subscribers', 'merchant' ), |
| 65 |
'default' => __( 'Hello, thank you for subscribing to the stock waitlist for {product}. We will email you once the product back in stock.', 'merchant' ), |
| 66 |
'desc' => esc_html__( 'The message that will be sent to new subscribers.', 'merchant' ), |
| 67 |
), |
| 68 |
|
| 69 |
array( |
| 70 |
'id' => 'email_update', |
| 71 |
'type' => 'textarea', |
| 72 |
'title' => esc_html__( 'Email in stock update', 'merchant' ), |
| 73 |
'default' => __( 'Hello, thanks for your patience — finally, the wait is over! Your {product} is now back in stock! We only have a limited amount of stock, and this email is not a guarantee you’ll get one. Add this {product} directly to your cart.', |
| 74 |
'merchant' ), |
| 75 |
'desc' => esc_html__( 'The message that will be sent to subscribers when product is in stock.', 'merchant' ), |
| 76 |
), |
| 77 |
|
| 78 |
), |
| 79 |
) ); |
| 80 |
|
| 81 |
// Shortcode |
| 82 |
$merchant_module_id = Merchant_Wait_List::MODULE_ID; |
| 83 |
Merchant_Admin_Options::create( array( |
| 84 |
'module' => $merchant_module_id, |
| 85 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 86 |
'fields' => array( |
| 87 |
array( |
| 88 |
'id' => 'use_shortcode', |
| 89 |
'type' => 'switcher', |
| 90 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 91 |
'default' => 0, |
| 92 |
'desc' => 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.', |
| 93 |
'merchant' ), |
| 94 |
), |
| 95 |
array( |
| 96 |
'id' => 'shortcode_text', |
| 97 |
'type' => 'text_readonly', |
| 98 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 99 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 100 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 101 |
), |
| 102 |
), |
| 103 |
) ); |