| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Product bundles — 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 |
/** |
| 17 |
* Hook functionality before including modules options. |
| 18 |
* |
| 19 |
* @since 1.9.8 |
| 20 |
*/ |
| 21 |
|
| 22 |
return array( |
| 23 |
array( |
| 24 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 25 |
'title' => esc_html__( 'Product page settings', 'merchant' ), |
| 26 |
'fields' => array( |
| 27 |
|
| 28 |
array( |
| 29 |
'id' => 'price_range', |
| 30 |
'type' => 'switcher', |
| 31 |
'title' => __( 'Display bundle price as range for variable products', 'merchant' ), |
| 32 |
'desc' => __( 'Display a price range for bundles that include variable products.', 'merchant' ), |
| 33 |
'default' => '1', |
| 34 |
'ai_meta' => array( |
| 35 |
'usage_hint' => 'Only affects bundles that contain variable products. When on, the bundle price shows as a range (e.g. $10–$30). When off, a single computed price is shown.', |
| 36 |
), |
| 37 |
), |
| 38 |
|
| 39 |
array( |
| 40 |
'id' => 'bundled_thumb', |
| 41 |
'type' => 'switcher', |
| 42 |
'title' => __( 'Display bundled product thumbnails', 'merchant' ), |
| 43 |
'default' => '1', |
| 44 |
), |
| 45 |
|
| 46 |
array( |
| 47 |
'id' => 'bundled_description', |
| 48 |
'type' => 'switcher', |
| 49 |
'title' => __( 'Display bundled product descriptions', 'merchant' ), |
| 50 |
'default' => 0, |
| 51 |
), |
| 52 |
|
| 53 |
array( |
| 54 |
'id' => 'bundled_qty', |
| 55 |
'type' => 'switcher', |
| 56 |
'title' => __( 'Display bundled product quantities', 'merchant' ), |
| 57 |
'default' => '1', |
| 58 |
), |
| 59 |
|
| 60 |
array( |
| 61 |
'id' => 'bundled_link_single', |
| 62 |
'type' => 'switcher', |
| 63 |
'title' => __( 'Make bundled product thumbnails and titles clickable', 'merchant' ), |
| 64 |
'default' => '1', |
| 65 |
), |
| 66 |
|
| 67 |
array( |
| 68 |
'id' => 'bundled_price', |
| 69 |
'type' => 'select', |
| 70 |
'title' => __( 'Display the prices of bundled products', 'merchant' ), |
| 71 |
'options' => array( |
| 72 |
'price' => __( 'Price per unit', 'merchant' ), |
| 73 |
'subtotal' => __( 'Subtotal', 'merchant' ), |
| 74 |
'no' => __( 'Hide', 'merchant' ), |
| 75 |
), |
| 76 |
'default' => 'price', |
| 77 |
'ai_meta' => array( |
| 78 |
'usage_hint' => 'Controls how individual bundled product prices are displayed. Use price for per-unit display, subtotal for quantity-multiplied totals, or no to hide prices. Does not affect the bundle total price.', |
| 79 |
), |
| 80 |
), |
| 81 |
|
| 82 |
array( |
| 83 |
'id' => 'bundled_price_from', |
| 84 |
'type' => 'select', |
| 85 |
'title' => __( 'Calculate the prices of bundled products based on', 'merchant' ), |
| 86 |
'options' => array( |
| 87 |
'regular_price' => __( 'Regular price', 'merchant' ), |
| 88 |
'sale_price' => __( 'Sale Price', 'merchant' ), |
| 89 |
), |
| 90 |
'default' => 'sale_price', |
| 91 |
'ai_meta' => array( |
| 92 |
'usage_hint' => 'Determines the price base for bundled product calculations. Use sale_price to reflect current sale discounts, or regular_price to always use the non-discounted price regardless of active sales.', |
| 93 |
), |
| 94 |
), |
| 95 |
|
| 96 |
array( |
| 97 |
'id' => 'placement', |
| 98 |
'type' => 'select', |
| 99 |
'title' => __( 'Where to display the bundled products', 'merchant' ), |
| 100 |
'options' => array( |
| 101 |
'woocommerce_before_add_to_cart_form' => __( 'Before add to cart section', 'merchant' ), |
| 102 |
'woocommerce_after_add_to_cart_form' => __( 'After add to cart section', 'merchant' ), |
| 103 |
), |
| 104 |
'default' => 'before_form', |
| 105 |
), |
| 106 |
), |
| 107 |
), |
| 108 |
array( |
| 109 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 110 |
'title' => esc_html__( 'Cart settings', 'merchant' ), |
| 111 |
'fields' => array( |
| 112 |
array( |
| 113 |
'id' => 'hide_bundled_cart', |
| 114 |
'type' => 'switcher', |
| 115 |
'title' => __( 'Hide bundled products in cart', 'merchant' ), |
| 116 |
'default' => 0, |
| 117 |
'ai_meta' => array( |
| 118 |
'usage_hint' => 'Hides individual bundled items in the cart page so only the bundle parent is shown. Does NOT affect mini cart — use hide_bundled_mini_cart for that.', |
| 119 |
), |
| 120 |
), |
| 121 |
|
| 122 |
array( |
| 123 |
'id' => 'hide_bundled_mini_cart', |
| 124 |
'type' => 'switcher', |
| 125 |
'title' => __( 'Hide bundled products in mini cart', 'merchant' ), |
| 126 |
'default' => 0, |
| 127 |
'ai_meta' => array( |
| 128 |
'usage_hint' => 'Hides individual bundled items in the mini cart widget so only the bundle parent is shown. Does NOT affect the main cart page — use hide_bundled_cart for that.', |
| 129 |
), |
| 130 |
), |
| 131 |
|
| 132 |
// array( |
| 133 |
// 'id' => '_woopq_decimal', |
| 134 |
// 'type' => 'switcher', |
| 135 |
// 'title' => __( 'Allow decimal product quantity', 'merchant' ), |
| 136 |
// 'default' => 0, |
| 137 |
// ), |
| 138 |
|
| 139 |
array( |
| 140 |
'id' => 'bundled_link', |
| 141 |
'type' => 'switcher', |
| 142 |
'title' => __( 'Include links to bundled products on cart page', 'merchant' ), |
| 143 |
'default' => '1', |
| 144 |
), |
| 145 |
|
| 146 |
array( |
| 147 |
'id' => 'cart_contents_count', |
| 148 |
'type' => 'select', |
| 149 |
'title' => __( 'Cart contents count will include', 'merchant' ), |
| 150 |
'options' => array( |
| 151 |
'bundle' => __( 'The bundle as one product', 'merchant' ), |
| 152 |
'both' => __( 'Both bundle and bundled products', 'merchant' ), |
| 153 |
), |
| 154 |
'default' => 'bundle', |
| 155 |
'ai_meta' => array( |
| 156 |
'usage_hint' => 'Controls the cart item count shown in the cart icon. Use bundle to count the bundle as 1 item, or both to count the bundle plus each individual bundled product separately.', |
| 157 |
), |
| 158 |
), |
| 159 |
|
| 160 |
array( |
| 161 |
'id' => 'hide_bundled', |
| 162 |
'type' => 'radio', |
| 163 |
'title' => __( 'Show bundled products', 'merchant' ), |
| 164 |
'options' => array( |
| 165 |
'text' => __( 'List inline', 'merchant' ), |
| 166 |
'list' => __( 'Bulleted list', 'merchant' ), |
| 167 |
), |
| 168 |
'default' => 'text', |
| 169 |
), |
| 170 |
), |
| 171 |
), |
| 172 |
array( |
| 173 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 174 |
'title' => esc_html__( 'Order email settings', 'merchant' ), |
| 175 |
'fields' => array( |
| 176 |
array( |
| 177 |
'id' => 'hide_bundled_order_email', |
| 178 |
'type' => 'switcher', |
| 179 |
'title' => __( 'Hide bundled products in order email', 'merchant' ), |
| 180 |
'default' => 0, |
| 181 |
), |
| 182 |
), |
| 183 |
), |
| 184 |
array( |
| 185 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 186 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 187 |
'fields' => array( |
| 188 |
array( |
| 189 |
'id' => 'use_shortcode', |
| 190 |
'type' => 'switcher', |
| 191 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 192 |
'default' => 0, |
| 193 |
), |
| 194 |
array( |
| 195 |
'type' => 'info', |
| 196 |
'id' => 'shortcode_info', |
| 197 |
'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.', |
| 198 |
'merchant' ), |
| 199 |
), |
| 200 |
array( |
| 201 |
'id' => 'shortcode_text', |
| 202 |
'type' => 'text_readonly', |
| 203 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 204 |
'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Product_Bundles::MODULE_ID ) . ']', |
| 205 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 206 |
), |
| 207 |
), |
| 208 |
), |
| 209 |
); |
| 210 |
|