| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Add To Cart Text Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
// Settings |
| 14 |
Merchant_Admin_Options::create( array( |
| 15 |
'module' => Merchant_Add_To_Cart_Text::MODULE_ID, |
| 16 |
'title' => esc_html__( 'Simple Product', 'merchant' ), |
| 17 |
'fields' => array( |
| 18 |
array( |
| 19 |
'id' => 'simple_product_shop_label', |
| 20 |
'type' => 'text', |
| 21 |
'title' => esc_html__( 'Label', 'merchant' ), |
| 22 |
'default' => esc_html__( 'Add to cart', 'merchant' ), |
| 23 |
/* Translators: 1. Link open tag 2. Link close tag */ |
| 24 |
'desc' => sprintf( esc_html__( 'Note: If you want to add a different label for each product, go to %1$sProducts%2$s, edit the desired product, set the label inside the metabox.', |
| 25 |
'merchant' ), |
| 26 |
'<a href="' . esc_url( admin_url( 'edit.php?post_type=product' ) ) . '">', |
| 27 |
'</a>' ), |
| 28 |
), |
| 29 |
|
| 30 |
array( |
| 31 |
'id' => 'simple_product_custom_single_label', |
| 32 |
'type' => 'switcher', |
| 33 |
'title' => __( 'Customize label on single product page', 'merchant' ), |
| 34 |
'default' => 0 |
| 35 |
), |
| 36 |
|
| 37 |
array( |
| 38 |
'id' => 'simple_product_label', |
| 39 |
'type' => 'text', |
| 40 |
'title' => esc_html__( 'Label on single product page', 'merchant' ), |
| 41 |
'default' => esc_html__( 'Add to cart', 'merchant' ), |
| 42 |
'condition' => array( 'simple_product_custom_single_label', '==', true ), |
| 43 |
), |
| 44 |
), |
| 45 |
) ); |
| 46 |
|
| 47 |
|
| 48 |
// Text Formatting Settings |
| 49 |
Merchant_Admin_Options::create( array( |
| 50 |
'module' => Merchant_Add_To_Cart_Text::MODULE_ID, |
| 51 |
'title' => esc_html__( 'Variable Product', 'merchant' ), |
| 52 |
'fields' => array( |
| 53 |
array( |
| 54 |
'id' => 'variable_product_shop_label', |
| 55 |
'type' => 'text', |
| 56 |
'title' => esc_html__( 'Label', 'merchant' ), |
| 57 |
'default' => esc_html__( 'Select options', 'merchant' ), |
| 58 |
/* Translators: 1. Link open tag 2. Link close tag */ |
| 59 |
'desc' => sprintf( esc_html__( 'Note: If you want to add a different label for each product, go to %1$sProducts%2$s, edit the desired product, set the label inside the metabox.', |
| 60 |
'merchant' ), |
| 61 |
'<a href="' . esc_url( admin_url( 'edit.php?post_type=product' ) ) . '">', |
| 62 |
'</a>' ), |
| 63 |
), |
| 64 |
|
| 65 |
array( |
| 66 |
'id' => 'variable_product_custom_single_label', |
| 67 |
'type' => 'switcher', |
| 68 |
'title' => __( 'Customize label on single product page', 'merchant' ), |
| 69 |
'default' => 0 |
| 70 |
), |
| 71 |
|
| 72 |
array( |
| 73 |
'id' => 'variable_product_label', |
| 74 |
'type' => 'text', |
| 75 |
'title' => esc_html__( 'Label on single product page', 'merchant' ), |
| 76 |
'default' => esc_html__( 'Add to cart', 'merchant' ), |
| 77 |
'condition' => array( 'variable_product_custom_single_label', '==', true ), |
| 78 |
), |
| 79 |
) |
| 80 |
) ); |
| 81 |
|
| 82 |
Merchant_Admin_Options::create( array( |
| 83 |
'module' => Merchant_Add_To_Cart_Text::MODULE_ID, |
| 84 |
'title' => esc_html__( 'Out of Stock Product', 'merchant' ), |
| 85 |
'fields' => array( |
| 86 |
array( |
| 87 |
'id' => 'out_of_stock_custom_label', |
| 88 |
'type' => 'switcher', |
| 89 |
'title' => __( 'Alter the label text when the product is out of stock', 'merchant' ), |
| 90 |
'default' => 0 |
| 91 |
), |
| 92 |
array( |
| 93 |
'id' => 'out_of_stock_shop_label', |
| 94 |
'type' => 'text', |
| 95 |
'title' => esc_html__( 'Label', 'merchant' ), |
| 96 |
'default' => esc_html__( 'Out of stock', 'merchant' ), |
| 97 |
'condition' => array( 'out_of_stock_custom_label', '==', true ), |
| 98 |
), |
| 99 |
), |
| 100 |
) ); |
| 101 |
|