| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Stock Scarcity Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
// Settings |
| 15 |
Merchant_Admin_Options::create( array( |
| 16 |
'module' => Merchant_Stock_Scarcity::MODULE_ID, |
| 17 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 18 |
'fields' => array( |
| 19 |
array( |
| 20 |
'id' => 'single_product_placement', |
| 21 |
'type' => 'select', |
| 22 |
'title' => esc_html__( 'Placement on product page', 'merchant' ), |
| 23 |
'options' => array( |
| 24 |
'after-cart-form' => esc_html__( 'After add to cart form', 'merchant' ), |
| 25 |
'before-cart-form' => esc_html__( 'Before add to cart form', 'merchant' ), |
| 26 |
), |
| 27 |
'default' => 'after-cart-form' |
| 28 |
), |
| 29 |
array( |
| 30 |
'id' => 'min_inventory', |
| 31 |
'type' => 'number', |
| 32 |
'title' => esc_html__( 'Show urgency box when variant inventory is below', 'merchant' ), |
| 33 |
'default' => 50, |
| 34 |
), |
| 35 |
|
| 36 |
), |
| 37 |
) ); |
| 38 |
|
| 39 |
|
| 40 |
// Text Formatting Settings |
| 41 |
Merchant_Admin_Options::create( array( |
| 42 |
'title' => esc_html__( 'Text Formatting Settings', 'merchant' ), |
| 43 |
'module' => Merchant_Stock_Scarcity::MODULE_ID, |
| 44 |
'fields' => array( |
| 45 |
|
| 46 |
array( |
| 47 |
'id' => 'low_inventory_text', |
| 48 |
'type' => 'text', |
| 49 |
'title' => esc_html__( 'Text when inventory is low', 'merchant' ), |
| 50 |
'default' => esc_html__( 'Hurry! Only {stock} units left in stock!', 'merchant' ), |
| 51 |
), |
| 52 |
) |
| 53 |
) ); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
// Style |
| 58 |
Merchant_Admin_Options::create( array( |
| 59 |
'module' => Merchant_Stock_Scarcity::MODULE_ID, |
| 60 |
'title' => esc_html__( 'Style', 'merchant' ), |
| 61 |
'fields' => array( |
| 62 |
|
| 63 |
array( |
| 64 |
'id' => 'gradient_start', |
| 65 |
'type' => 'color', |
| 66 |
'title' => esc_html__( 'Progress bar gradient start', 'merchant' ), |
| 67 |
'default' => '#ffc108' |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'gradient_end', |
| 72 |
'type' => 'color', |
| 73 |
'title' => esc_html__( 'Progress bar gradient end', 'merchant' ), |
| 74 |
'default' => '#d61313' |
| 75 |
), |
| 76 |
|
| 77 |
array( |
| 78 |
'id' => 'progress_bar_bg', |
| 79 |
'type' => 'color', |
| 80 |
'title' => esc_html__( 'Progress bar background color', 'merchant' ), |
| 81 |
'default' => '#e1e1e1' |
| 82 |
), |
| 83 |
|
| 84 |
array( |
| 85 |
'id' => 'text_font_weight', |
| 86 |
'type' => 'select', |
| 87 |
'title' => esc_html__( 'Text font weight', 'merchant' ), |
| 88 |
'options' => array( |
| 89 |
'lighter' => esc_html__( 'Light', 'merchant' ), |
| 90 |
'normal' => esc_html__( 'Normal', 'merchant' ), |
| 91 |
'bold' => esc_html__( 'Bold', 'merchant' ), |
| 92 |
), |
| 93 |
'default' => 'normal' |
| 94 |
), |
| 95 |
|
| 96 |
array( |
| 97 |
'id' => 'text_font_size', |
| 98 |
'type' => 'range', |
| 99 |
'title' => esc_html__( 'Text font size', 'merchant' ), |
| 100 |
'min' => 0, |
| 101 |
'max' => 100, |
| 102 |
'step' => 1, |
| 103 |
'unit' => 'px', |
| 104 |
'default' => 16 |
| 105 |
), |
| 106 |
|
| 107 |
array( |
| 108 |
'id' => 'text_text_color', |
| 109 |
'type' => 'color', |
| 110 |
'title' => esc_html__( 'Text text color', 'merchant' ), |
| 111 |
'default' => '#212121' |
| 112 |
), |
| 113 |
|
| 114 |
), |
| 115 |
) ); |
| 116 |
|