| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Wait List — Option group definitions. |
| 5 |
* |
| 6 |
* Pure data file. Returns the option groups array |
| 7 |
* consumed by init_option_groups(). |
| 8 |
* |
| 9 |
* @package Merchant |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; // Exit if accessed directly |
| 14 |
} |
| 15 |
|
| 16 |
// Form Settings |
| 17 |
|
| 18 |
return array( |
| 19 |
array( |
| 20 |
'title' => esc_html__( 'Form Settings', 'merchant' ), |
| 21 |
'module' => Merchant_Wait_List::MODULE_ID, |
| 22 |
'fields' => array( |
| 23 |
|
| 24 |
array( |
| 25 |
'id' => 'display_on_backorders', |
| 26 |
'type' => 'switcher', |
| 27 |
'title' => esc_html__( 'Display on backorders?', 'merchant' ), |
| 28 |
), |
| 29 |
|
| 30 |
array( |
| 31 |
'id' => 'form_title', |
| 32 |
'type' => 'text', |
| 33 |
'title' => esc_html__( 'Form title', 'merchant' ), |
| 34 |
'default' => __( 'Email me when this item is back in stock.', 'merchant' ), |
| 35 |
), |
| 36 |
|
| 37 |
array( |
| 38 |
'id' => 'form_email_label', |
| 39 |
'type' => 'text', |
| 40 |
'title' => esc_html__( 'Form email label', 'merchant' ), |
| 41 |
'default' => __( 'Your Email Address', 'merchant' ), |
| 42 |
), |
| 43 |
|
| 44 |
array( |
| 45 |
'id' => 'form_button_text', |
| 46 |
'type' => 'text', |
| 47 |
'title' => esc_html__( 'Form button text', 'merchant' ), |
| 48 |
'default' => __( 'Notify Me', 'merchant' ), |
| 49 |
), |
| 50 |
|
| 51 |
array( |
| 52 |
'id' => 'form_success_message', |
| 53 |
'type' => 'textarea', |
| 54 |
'title' => esc_html__( 'Form success message', 'merchant' ), |
| 55 |
'default' => __( 'You are now subscribed to our stock notification list for this product. When stock becomes available, we will let you know via email.', 'merchant' ), |
| 56 |
'desc' => esc_html__( 'The message that will show after form submission.', 'merchant' ), |
| 57 |
), |
| 58 |
array( |
| 59 |
'id' => 'form_unsubscribe_message', |
| 60 |
'type' => 'textarea', |
| 61 |
'title' => esc_html__( 'Form unsubscribe message', 'merchant' ), |
| 62 |
'default' => __( 'You have been successfully unsubscribed from our stock waitlist for this product.', 'merchant' ), |
| 63 |
'desc' => esc_html__( 'The message that will show after clicking on the unsubscribe link.', 'merchant' ), |
| 64 |
), |
| 65 |
array( |
| 66 |
'id' => 'exclude_products', |
| 67 |
'type' => 'products_selector', |
| 68 |
'title' => esc_html__( 'Exclude products', 'merchant' ), |
| 69 |
'multiple' => true, |
| 70 |
'desc' => esc_html__( 'Select any products that will be excluded from the waitlist.', 'merchant' ), |
| 71 |
'allowed_types' => array( 'simple', 'variable' ), |
| 72 |
'ai_meta' => array( |
| 73 |
'entity' => 'product', |
| 74 |
'reference_type' => 'static', |
| 75 |
'value_format' => 'product_id', |
| 76 |
'usage_hint' => 'Specific products to exclude from the waitlist globally. Static: only the selected products are excluded. For module-wide exclusion of simple and variable products by ID.', |
| 77 |
), |
| 78 |
), |
| 79 |
), |
| 80 |
), |
| 81 |
array( |
| 82 |
'title' => esc_html__( 'Email Settings', 'merchant' ), |
| 83 |
'module' => Merchant_Wait_List::MODULE_ID, |
| 84 |
'fields' => array( |
| 85 |
|
| 86 |
array( |
| 87 |
'id' => 'use_automatic_emails', |
| 88 |
'type' => 'switcher', |
| 89 |
'title' => __( 'Send emails automatically', 'merchant' ), |
| 90 |
'default' => 1, |
| 91 |
'desc' => esc_html__( 'When products are back in stock, send emails automatically to subscribers to let them know.', 'merchant' ), |
| 92 |
), |
| 93 |
|
| 94 |
array( |
| 95 |
'id' => 'show_notified_users', |
| 96 |
'type' => 'switcher', |
| 97 |
'title' => __( 'Show notified users', 'merchant' ), |
| 98 |
'default' => 1, |
| 99 |
'desc' => esc_html__( 'When products are back in stock, show an admin notice with a list of the notified users', 'merchant' ), |
| 100 |
), |
| 101 |
|
| 102 |
array( |
| 103 |
'id' => 'email_new_subscriber', |
| 104 |
'type' => 'textarea_multiline', |
| 105 |
'title' => esc_html__( 'Email new subscribers', 'merchant' ), |
| 106 |
'default' => __( 'Hello, thank you for joining the stock notification list for {product}. We will email you when the product is back in stock.', 'merchant' ), |
| 107 |
'desc' => esc_html__( 'The message that will be sent to new subscribers.', 'merchant' ), |
| 108 |
), |
| 109 |
|
| 110 |
array( |
| 111 |
'id' => 'email_new_subscriber_info', |
| 112 |
'type' => 'info', |
| 113 |
'content' => sprintf( |
| 114 |
/* Translators: 1. docs link */ |
| 115 |
__( 'Click <a href="%1$s" target="_blank">here</a> to preview the new subscriber email.', 'merchant' ), |
| 116 |
esc_url( |
| 117 |
add_query_arg( |
| 118 |
array( |
| 119 |
'action' => 'merchant_pro_preview_new_subscriber_email', |
| 120 |
'nonce' => wp_create_nonce( 'merchant_pro_wait_list_mailer_preview' ), |
| 121 |
), |
| 122 |
admin_url( 'admin-post.php' ) |
| 123 |
) |
| 124 |
) |
| 125 |
), |
| 126 |
), |
| 127 |
|
| 128 |
array( |
| 129 |
'id' => 'email_update', |
| 130 |
'type' => 'textarea_multiline', |
| 131 |
'title' => esc_html__( 'Email in stock update', 'merchant' ), |
| 132 |
'default' => __( 'Hello, we’re pleased to let you know that {product} is now back in stock.', |
| 133 |
'merchant' ), |
| 134 |
'desc' => esc_html__( 'The message that will be sent to subscribers when a product is back in stock.', 'merchant' ), |
| 135 |
), |
| 136 |
array( |
| 137 |
'id' => 'email_update_info', |
| 138 |
'type' => 'info', |
| 139 |
'content' => sprintf( |
| 140 |
/* Translators: 1. docs link */ |
| 141 |
__( 'Click <a href="%1$s" target="_blank">here</a> to preview the stock update email.', 'merchant' ), |
| 142 |
esc_url( |
| 143 |
add_query_arg( |
| 144 |
array( |
| 145 |
'action' => 'merchant_pro_preview_stock_update_email', |
| 146 |
'nonce' => wp_create_nonce( 'merchant_pro_wait_list_mailer_preview' ), |
| 147 |
), |
| 148 |
admin_url( 'admin-post.php' ) |
| 149 |
) |
| 150 |
) |
| 151 |
), |
| 152 |
), |
| 153 |
), |
| 154 |
), |
| 155 |
array( |
| 156 |
'module' => Merchant_Wait_List::MODULE_ID, |
| 157 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 158 |
'fields' => array( |
| 159 |
array( |
| 160 |
'id' => 'use_shortcode', |
| 161 |
'type' => 'switcher', |
| 162 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 163 |
'default' => 0, |
| 164 |
), |
| 165 |
array( |
| 166 |
'type' => 'info', |
| 167 |
'id' => 'shortcode_info', |
| 168 |
'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.', 'merchant' ), |
| 169 |
), |
| 170 |
array( |
| 171 |
'id' => 'shortcode_text', |
| 172 |
'type' => 'text_readonly', |
| 173 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 174 |
'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Wait_List::MODULE_ID ) . ']', |
| 175 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 176 |
), |
| 177 |
), |
| 178 |
), |
| 179 |
); |
| 180 |
|