| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Free Gifts Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
Merchant_Admin_Options::create( array( |
| 14 |
'title' => esc_html__( 'Floating Gift Widget', 'merchant' ), |
| 15 |
'module' => Merchant_Free_Gifts::MODULE_ID, |
| 16 |
'fields' => array( |
| 17 |
array( |
| 18 |
'id' => 'offers', |
| 19 |
'type' => 'flexible_content', |
| 20 |
'button_label' => esc_html__( 'Add New Offer', 'merchant' ), |
| 21 |
'style' => Merchant_Free_Gifts::MODULE_ID . '-style default', |
| 22 |
'sorting' => true, |
| 23 |
'accordion' => true, |
| 24 |
'duplicate' => true, |
| 25 |
'layouts' => array( |
| 26 |
'spending' => array( |
| 27 |
'title' => esc_html__( 'Spending Based', 'merchant' ), |
| 28 |
'title-field' => 'offer-title', // text field ID to use as title for the layout |
| 29 |
'status-field' => 'campaign_status', |
| 30 |
'fields' => array( |
| 31 |
array( |
| 32 |
'id' => 'campaign_status', |
| 33 |
'type' => 'select', |
| 34 |
'title' => esc_html__( 'Status', 'merchant' ), |
| 35 |
'options' => array( |
| 36 |
'active' => esc_html__( 'Active', 'merchant' ), |
| 37 |
'inactive' => esc_html__( 'Inactive', 'merchant' ), |
| 38 |
), |
| 39 |
'default' => 'active', |
| 40 |
), |
| 41 |
array( |
| 42 |
'id' => 'offer-title', |
| 43 |
'type' => 'text', |
| 44 |
'title' => esc_html__( 'Offer name', 'merchant' ), |
| 45 |
'default' => esc_html__( 'Free Gift Campaign', 'merchant' ), |
| 46 |
), |
| 47 |
array( |
| 48 |
'id' => 'rules_to_apply', |
| 49 |
'type' => 'select', |
| 50 |
'title' => esc_html__( 'Products that can be purchased to claim the gift', 'merchant' ), |
| 51 |
'options' => array( |
| 52 |
'all' => esc_html__( 'All Products', 'merchant' ), |
| 53 |
'product' => esc_html__( 'Specific Products', 'merchant' ), |
| 54 |
'categories' => esc_html__( 'Specific Categories', 'merchant' ), |
| 55 |
'tags' => esc_html__( 'Specific Tags', 'merchant' ), |
| 56 |
'brands' => esc_html__( 'Specific Brands', 'merchant' ), |
| 57 |
), |
| 58 |
'default' => 'all', |
| 59 |
), |
| 60 |
|
| 61 |
array( |
| 62 |
'id' => 'product_to_purchase', |
| 63 |
'type' => 'products_selector', |
| 64 |
'multiple' => false, |
| 65 |
'desc' => esc_html__( 'Select the products that the spending goal will apply to.', 'merchant' ), |
| 66 |
'condition' => array( 'rules_to_apply', '==', 'product' ), |
| 67 |
'allowed_types' => array( 'simple', 'variable' ), |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'category_slugs', |
| 72 |
'type' => 'select_ajax', |
| 73 |
'title' => esc_html__( 'Categories', 'merchant' ), |
| 74 |
'source' => 'options', |
| 75 |
'multiple' => true, |
| 76 |
'options' => Merchant_Admin_Options::get_category_select2_choices(), |
| 77 |
'placeholder' => esc_html__( 'Select categories', 'merchant' ), |
| 78 |
'desc' => esc_html__( 'Select the product categories that the spending goal will apply to.', 'merchant' ), |
| 79 |
'condition' => array( 'rules_to_apply', '==', 'categories' ), |
| 80 |
), |
| 81 |
|
| 82 |
array( |
| 83 |
'id' => 'tag_slugs', |
| 84 |
'type' => 'select_ajax', |
| 85 |
'title' => esc_html__( 'Tags', 'merchant' ), |
| 86 |
'source' => 'options', |
| 87 |
'multiple' => true, |
| 88 |
'options' => Merchant_Admin_Options::get_tag_select2_choices(), |
| 89 |
'placeholder' => esc_html__( 'Select tags', 'merchant' ), |
| 90 |
'desc' => esc_html__( 'Select the product tags that the spending goal will apply to.', 'merchant' ), |
| 91 |
'condition' => array( 'rules_to_apply', '==', 'tags' ), |
| 92 |
), |
| 93 |
array( |
| 94 |
'id' => 'brand_slugs', |
| 95 |
'type' => 'select_ajax', |
| 96 |
'title' => esc_html__( 'Brands', 'merchant' ), |
| 97 |
'source' => 'options', |
| 98 |
'multiple' => true, |
| 99 |
'options' => Merchant_Admin_Options::get_brand_select2_choices(), |
| 100 |
'placeholder' => esc_html__( 'Select brands', 'merchant' ), |
| 101 |
'desc' => esc_html__( 'Select the product brands that the spending goal will apply to.', 'merchant' ), |
| 102 |
'condition' => array( 'rules_to_apply', '==', 'brands' ), |
| 103 |
), |
| 104 |
|
| 105 |
array( |
| 106 |
'id' => 'exclude_products_toggle', |
| 107 |
'type' => 'switcher', |
| 108 |
'title' => esc_html__( 'Exclude Products', 'merchant' ), |
| 109 |
'desc' => esc_html__( 'Exclude specific products from this campaign.', 'merchant' ), |
| 110 |
'default' => 0, |
| 111 |
'conditions' => array( |
| 112 |
'relation' => 'AND', |
| 113 |
'terms' => array( |
| 114 |
array( |
| 115 |
'field' => 'rules_to_apply', |
| 116 |
'operator' => 'in', |
| 117 |
'value' => array( 'all', 'categories', 'tags', 'brands' ), |
| 118 |
), |
| 119 |
), |
| 120 |
), |
| 121 |
), |
| 122 |
|
| 123 |
array( |
| 124 |
'id' => 'excluded_products', |
| 125 |
'type' => 'products_selector', |
| 126 |
'title' => esc_html__( 'Excluded Products List', 'merchant' ), |
| 127 |
'multiple' => true, |
| 128 |
'desc' => esc_html__( 'Select the products that the spending goal will not apply to.', 'merchant' ), |
| 129 |
'conditions' => array( |
| 130 |
'relation' => 'AND', |
| 131 |
'terms' => array( |
| 132 |
array( |
| 133 |
'field' => 'rules_to_apply', |
| 134 |
'operator' => 'in', |
| 135 |
'value' => array( 'all', 'categories', 'tags', 'brands' ), |
| 136 |
), |
| 137 |
array( |
| 138 |
'field' => 'exclude_products_toggle', |
| 139 |
'operator' => '===', |
| 140 |
'value' => true, |
| 141 |
), |
| 142 |
), |
| 143 |
), |
| 144 |
), |
| 145 |
|
| 146 |
array( |
| 147 |
'id' => 'exclude_categories_toggle', |
| 148 |
'type' => 'switcher', |
| 149 |
'title' => esc_html__( 'Exclude Categories', 'merchant' ), |
| 150 |
'desc' => esc_html__( 'Exclude specific categories from this campaign.', 'merchant' ), |
| 151 |
'default' => 0, |
| 152 |
'conditions' => array( |
| 153 |
'relation' => 'AND', |
| 154 |
'terms' => array( |
| 155 |
array( |
| 156 |
'field' => 'rules_to_apply', |
| 157 |
'operator' => 'in', |
| 158 |
'value' => array( 'all', 'tags', 'brands' ), |
| 159 |
), |
| 160 |
), |
| 161 |
), |
| 162 |
), |
| 163 |
|
| 164 |
array( |
| 165 |
'id' => 'excluded_categories', |
| 166 |
'type' => 'select_ajax', |
| 167 |
'title' => esc_html__( 'Excluded Categories List', 'merchant' ), |
| 168 |
'source' => 'options', |
| 169 |
'multiple' => true, |
| 170 |
'options' => Merchant_Admin_Options::get_category_select2_choices(), |
| 171 |
'placeholder' => esc_html__( 'Select categories', 'merchant' ), |
| 172 |
'desc' => esc_html__( 'Select the product categories that the spending goal will not apply to.', 'merchant' ), |
| 173 |
'conditions' => array( |
| 174 |
'relation' => 'AND', |
| 175 |
'terms' => array( |
| 176 |
array( |
| 177 |
'field' => 'rules_to_apply', |
| 178 |
'operator' => 'in', |
| 179 |
'value' => array( 'all', 'tags', 'brands' ), |
| 180 |
), |
| 181 |
array( |
| 182 |
'field' => 'exclude_categories_toggle', |
| 183 |
'operator' => '===', |
| 184 |
'value' => true, |
| 185 |
), |
| 186 |
), |
| 187 |
), |
| 188 |
), |
| 189 |
|
| 190 |
array( |
| 191 |
'id' => 'exclude_tags_toggle', |
| 192 |
'type' => 'switcher', |
| 193 |
'title' => esc_html__( 'Exclude Tags', 'merchant' ), |
| 194 |
'desc' => esc_html__( 'Exclude specific tags from this campaign.', 'merchant' ), |
| 195 |
'default' => 0, |
| 196 |
'conditions' => array( |
| 197 |
'relation' => 'AND', |
| 198 |
'terms' => array( |
| 199 |
array( |
| 200 |
'field' => 'rules_to_apply', |
| 201 |
'operator' => 'in', |
| 202 |
'value' => array( 'all', 'categories', 'brands' ), |
| 203 |
), |
| 204 |
), |
| 205 |
), |
| 206 |
), |
| 207 |
|
| 208 |
array( |
| 209 |
'id' => 'excluded_tags', |
| 210 |
'type' => 'select_ajax', |
| 211 |
'title' => esc_html__( 'Excluded Tags List', 'merchant' ), |
| 212 |
'source' => 'options', |
| 213 |
'multiple' => true, |
| 214 |
'options' => Merchant_Admin_Options::get_tag_select2_choices(), |
| 215 |
'placeholder' => esc_html__( 'Select tags', 'merchant' ), |
| 216 |
'desc' => esc_html__( 'Select the product tags that the spending goal will not apply to.', 'merchant' ), |
| 217 |
'conditions' => array( |
| 218 |
'relation' => 'AND', |
| 219 |
'terms' => array( |
| 220 |
array( |
| 221 |
'field' => 'rules_to_apply', |
| 222 |
'operator' => 'in', |
| 223 |
'value' => array( 'all', 'categories', 'brands' ), |
| 224 |
), |
| 225 |
array( |
| 226 |
'field' => 'exclude_tags_toggle', |
| 227 |
'operator' => '===', |
| 228 |
'value' => true, |
| 229 |
), |
| 230 |
), |
| 231 |
), |
| 232 |
), |
| 233 |
|
| 234 |
array( |
| 235 |
'id' => 'exclude_brands_toggle', |
| 236 |
'type' => 'switcher', |
| 237 |
'title' => esc_html__( 'Exclude Brands', 'merchant' ), |
| 238 |
'desc' => esc_html__( 'Exclude specific brands from this campaign.', 'merchant' ), |
| 239 |
'default' => 0, |
| 240 |
'conditions' => array( |
| 241 |
'relation' => 'AND', |
| 242 |
'terms' => array( |
| 243 |
array( |
| 244 |
'field' => 'rules_to_apply', |
| 245 |
'operator' => 'in', |
| 246 |
'value' => array( 'all', 'categories', 'tags' ), |
| 247 |
), |
| 248 |
), |
| 249 |
), |
| 250 |
), |
| 251 |
|
| 252 |
array( |
| 253 |
'id' => 'excluded_brands', |
| 254 |
'type' => 'select_ajax', |
| 255 |
'title' => esc_html__( 'Excluded Brands List', 'merchant' ), |
| 256 |
'source' => 'options', |
| 257 |
'multiple' => true, |
| 258 |
'options' => Merchant_Admin_Options::get_brand_select2_choices(), |
| 259 |
'placeholder' => esc_html__( 'Select brands', 'merchant' ), |
| 260 |
'desc' => esc_html__( 'Select the product brands that the spending goal will not apply to.', 'merchant' ), |
| 261 |
'conditions' => array( |
| 262 |
'relation' => 'AND', |
| 263 |
'terms' => array( |
| 264 |
array( |
| 265 |
'field' => 'rules_to_apply', |
| 266 |
'operator' => 'in', |
| 267 |
'value' => array( 'all', 'categories', 'tags' ), |
| 268 |
), |
| 269 |
array( |
| 270 |
'field' => 'exclude_brands_toggle', |
| 271 |
'operator' => '===', |
| 272 |
'value' => true, |
| 273 |
), |
| 274 |
), |
| 275 |
), |
| 276 |
), |
| 277 |
|
| 278 |
'amount' => array( |
| 279 |
'id' => 'amount', |
| 280 |
'title' => esc_html__( 'Spending goal', 'merchant' ), |
| 281 |
'type' => 'number', |
| 282 |
'step' => 0.01, |
| 283 |
'append' => function_exists( 'get_woocommerce_currency_symbol' ) ? get_woocommerce_currency() : esc_html__( 'USD', 'merchant' ), |
| 284 |
'default' => 100, |
| 285 |
), |
| 286 |
|
| 287 |
array( |
| 288 |
'id' => 'product', |
| 289 |
'type' => 'products_selector', |
| 290 |
'title' => esc_html__( 'Product rewarded as a gift', 'merchant' ), |
| 291 |
'multiple' => false, |
| 292 |
'allowed_types' => array( 'simple', 'variable', 'variation' ), |
| 293 |
), |
| 294 |
|
| 295 |
array( |
| 296 |
'id' => 'exclude_coupon', |
| 297 |
'type' => 'switcher', |
| 298 |
'title' => esc_html__( 'Exclude coupons', 'merchant' ), |
| 299 |
'desc' => esc_html__( 'Coupon codes will not be applicable on top of this offer.', 'merchant' ), |
| 300 |
'default' => 1, |
| 301 |
), |
| 302 |
|
| 303 |
array( |
| 304 |
'id' => 'user_condition', |
| 305 |
'type' => 'select', |
| 306 |
'title' => esc_html__( 'User Condition', 'merchant' ), |
| 307 |
'options' => array( |
| 308 |
'all' => esc_html__( 'All Users', 'merchant' ), |
| 309 |
'customers' => esc_html__( 'Selected Users', 'merchant' ), |
| 310 |
'roles' => esc_html__( 'Selected Roles', 'merchant' ), |
| 311 |
), |
| 312 |
'default' => 'all', |
| 313 |
), |
| 314 |
|
| 315 |
array( |
| 316 |
'id' => 'user_condition_roles', |
| 317 |
'type' => 'select_ajax', |
| 318 |
'title' => esc_html__( 'User Roles', 'merchant' ), |
| 319 |
'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ), |
| 320 |
'source' => 'options', |
| 321 |
'multiple' => true, |
| 322 |
'classes' => array( 'flex-grow' ), |
| 323 |
'options' => Merchant_Admin_Options::get_user_roles_select2_choices(), |
| 324 |
'condition' => array( 'user_condition', '==', 'roles' ), |
| 325 |
), |
| 326 |
|
| 327 |
array( |
| 328 |
'id' => 'user_condition_users', |
| 329 |
'type' => 'select_ajax', |
| 330 |
'title' => esc_html__( 'Users', 'merchant' ), |
| 331 |
'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ), |
| 332 |
'source' => 'user', |
| 333 |
'multiple' => true, |
| 334 |
'classes' => array( 'flex-grow' ), |
| 335 |
'condition' => array( 'user_condition', '==', 'customers' ), |
| 336 |
), |
| 337 |
|
| 338 |
array( |
| 339 |
'id' => 'user_exclusion_enabled', |
| 340 |
'type' => 'switcher', |
| 341 |
'title' => esc_html__( 'Exclusion List', 'merchant' ), |
| 342 |
'desc' => esc_html__( 'Select the users that will not show the offer.', 'merchant' ), |
| 343 |
'default' => 0, |
| 344 |
'conditions' => array( |
| 345 |
'relation' => 'AND', |
| 346 |
'terms' => array( |
| 347 |
array( |
| 348 |
'field' => 'user_condition', |
| 349 |
'operator' => 'in', |
| 350 |
'value' => array( 'all', 'roles' ), |
| 351 |
), |
| 352 |
), |
| 353 |
), |
| 354 |
), |
| 355 |
|
| 356 |
array( |
| 357 |
'id' => 'exclude_roles', |
| 358 |
'type' => 'select_ajax', |
| 359 |
'title' => esc_html__( 'Exclude Roles', 'merchant' ), |
| 360 |
'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ), |
| 361 |
'source' => 'options', |
| 362 |
'multiple' => true, |
| 363 |
'classes' => array( 'flex-grow' ), |
| 364 |
'options' => Merchant_Admin_Options::get_user_roles_select2_choices(), |
| 365 |
'conditions' => array( |
| 366 |
'relation' => 'AND', |
| 367 |
'terms' => array( |
| 368 |
array( |
| 369 |
'field' => 'user_condition', |
| 370 |
'operator' => 'in', |
| 371 |
'value' => array( 'all' ), |
| 372 |
), |
| 373 |
array( |
| 374 |
'field' => 'user_exclusion_enabled', |
| 375 |
'operator' => '===', |
| 376 |
'value' => true, |
| 377 |
), |
| 378 |
), |
| 379 |
), |
| 380 |
), |
| 381 |
|
| 382 |
array( |
| 383 |
'id' => 'exclude_users', |
| 384 |
'type' => 'select_ajax', |
| 385 |
'title' => esc_html__( 'Exclude Users', 'merchant' ), |
| 386 |
'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ), |
| 387 |
'source' => 'user', |
| 388 |
'multiple' => true, |
| 389 |
'classes' => array( 'flex-grow' ), |
| 390 |
'conditions' => array( |
| 391 |
'relation' => 'AND', |
| 392 |
'terms' => array( |
| 393 |
array( |
| 394 |
'field' => 'user_condition', |
| 395 |
'operator' => 'in', |
| 396 |
'value' => array( 'all', 'roles' ), |
| 397 |
), |
| 398 |
array( |
| 399 |
'field' => 'user_exclusion_enabled', |
| 400 |
'operator' => '===', |
| 401 |
'value' => true, |
| 402 |
), |
| 403 |
), |
| 404 |
), |
| 405 |
), |
| 406 |
|
| 407 |
array( |
| 408 |
'id' => 'spending_goal_target', |
| 409 |
'type' => 'content', |
| 410 |
'title' => esc_html__( 'Spending goal target', 'merchant' ), |
| 411 |
'content' => '', |
| 412 |
'desc' => esc_html__( 'Configure the text for the gift offer across five phases. Personalize the text at each phase to maximize conversions.', 'merchant' ), |
| 413 |
), |
| 414 |
|
| 415 |
array( |
| 416 |
'id' => 'spending_text_0', |
| 417 |
'type' => 'text', |
| 418 |
'title' => esc_html__( 'At 0%', 'merchant' ), |
| 419 |
'default' => sprintf( |
| 420 |
/* Translators: 1. goal amount */ |
| 421 |
esc_html__( 'Spend %1$s to receive this gift!', 'merchant' ), |
| 422 |
'{goalAmount}' // existing one is {amount} |
| 423 |
), |
| 424 |
), |
| 425 |
|
| 426 |
array( |
| 427 |
'id' => 'spending_text_1_to_99', |
| 428 |
'type' => 'text', |
| 429 |
'title' => esc_html__( 'Between 1 - 99%', 'merchant' ), |
| 430 |
'default' => sprintf( |
| 431 |
/* Translators: 1. more amount */ |
| 432 |
esc_html__( 'Spend %1$s more to receive this gift!', 'merchant' ), |
| 433 |
'{amountMore}' |
| 434 |
), |
| 435 |
), |
| 436 |
|
| 437 |
array( |
| 438 |
'id' => 'spending_text_100', |
| 439 |
'type' => 'text', |
| 440 |
'title' => esc_html__( 'At 100%', 'merchant' ), |
| 441 |
'default' => esc_html__( 'Congratulations! You are eligible to receive a free gift.', 'merchant' ), |
| 442 |
), |
| 443 |
|
| 444 |
array( |
| 445 |
'id' => 'text_before_claim', |
| 446 |
'type' => 'text', |
| 447 |
'title' => esc_html__( 'Reminder to claim the gift on the cart page', 'merchant' ), |
| 448 |
'default' => esc_html__( 'Don\'t forget to claim your free gift before checking out!', 'merchant' ), |
| 449 |
), |
| 450 |
|
| 451 |
array( |
| 452 |
'id' => 'text_after_claim', |
| 453 |
'type' => 'text', |
| 454 |
'title' => esc_html__( 'Gift claimed message', 'merchant' ), |
| 455 |
'default' => esc_html__( 'Your free gift has been added to your cart. Thank you for shopping with us!', 'merchant' ), |
| 456 |
), |
| 457 |
), |
| 458 |
), |
| 459 |
'coupon' => array( |
| 460 |
'title' => esc_html__( 'Coupon Based', 'merchant' ), |
| 461 |
'title-field' => 'offer-title', // text field ID to use as title for the layout |
| 462 |
'fields' => array( |
| 463 |
array( |
| 464 |
'id' => 'offer-title', |
| 465 |
'type' => 'text', |
| 466 |
'title' => esc_html__( 'Offer name', 'merchant' ), |
| 467 |
'default' => esc_html__( 'Campaign', 'merchant' ), |
| 468 |
), |
| 469 |
array( |
| 470 |
'id' => 'product', |
| 471 |
'type' => 'products_selector', |
| 472 |
'title' => esc_html__( 'Product', 'merchant' ), |
| 473 |
'multiple' => false, |
| 474 |
'desc' => esc_html__( 'Select the product that the coupon will apply to.', 'merchant' ), |
| 475 |
'allowed_types' => array( 'simple', 'variable', 'variation' ), |
| 476 |
), |
| 477 |
'coupon' => array( |
| 478 |
'id' => 'coupon', |
| 479 |
'title' => esc_html__( 'Select the coupon that will apply to this offer.', 'merchant' ), |
| 480 |
'type' => 'wc_coupons', |
| 481 |
), |
| 482 |
array( |
| 483 |
'id' => 'coupon_campaign_info', |
| 484 |
'type' => 'info_block', |
| 485 |
'description' => esc_html__( 'The offer won’t appear in the Free-Gifts widget unless the associated coupon is entered.', 'merchant' ), |
| 486 |
), |
| 487 |
), |
| 488 |
), |
| 489 |
), |
| 490 |
'default' => array( |
| 491 |
array( |
| 492 |
'layout' => 'spending', |
| 493 |
'min_quantity' => 2, |
| 494 |
'discount' => 10, |
| 495 |
'discount_type' => 'percentage_discount', |
| 496 |
), |
| 497 |
), |
| 498 |
), |
| 499 |
), |
| 500 |
) ); |
| 501 |
|
| 502 |
// Settings |
| 503 |
Merchant_Admin_Options::create( array( |
| 504 |
'module' => Merchant_Free_Gifts::MODULE_ID, |
| 505 |
'title' => esc_html__( 'Cart Settings', 'merchant' ), |
| 506 |
'fields' => array( |
| 507 |
array( |
| 508 |
'id' => 'gift_claim_method', |
| 509 |
'type' => 'select', |
| 510 |
'title' => esc_html__( 'Gift claim method', 'merchant' ), |
| 511 |
'desc' => esc_html__( 'Select how customers receive free gifts. ‘Manual’ requires customers to click a claim button, while ‘Automatic’ adds the gift to their cart once they meet the spending threshold.', 'merchant' ), |
| 512 |
'options' => array( |
| 513 |
'manual' => esc_html__( 'Manual', 'merchant' ), |
| 514 |
'automatic' => esc_html__( 'Automatic', 'merchant' ), |
| 515 |
), |
| 516 |
'default' => 'manual', |
| 517 |
), |
| 518 |
|
| 519 |
array( |
| 520 |
'id' => 'total_type', |
| 521 |
'type' => 'select', |
| 522 |
'title' => esc_html__( 'Gift based on spending type', 'merchant' ), |
| 523 |
'desc' => esc_html__( 'Select the basis for the gift spending goal: ‘Cart Subtotal’ (excludes tax and shipping) or ‘Cart Total’ (includes tax and shipping).', 'merchant' ), |
| 524 |
'options' => array( |
| 525 |
'subtotal' => esc_html__( 'Cart subtotal', 'merchant' ), |
| 526 |
'total' => esc_html__( 'Cart total', 'merchant' ), |
| 527 |
), |
| 528 |
'default' => 'subtotal', |
| 529 |
), |
| 530 |
|
| 531 |
array( |
| 532 |
'id' => 'free_text', |
| 533 |
'type' => 'text', |
| 534 |
'title' => esc_html__( 'Gift price label', 'merchant' ), |
| 535 |
'default' => esc_html__( 'Free', 'merchant' ), |
| 536 |
), |
| 537 |
|
| 538 |
array( |
| 539 |
'id' => 'cart_title_text', |
| 540 |
'type' => 'text', |
| 541 |
'title' => esc_html__( 'Cart item title text', 'merchant' ), |
| 542 |
'default' => esc_html__( 'Free Gift', 'merchant' ), |
| 543 |
'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ), |
| 544 |
), |
| 545 |
|
| 546 |
array( |
| 547 |
'id' => 'cart_description_text', |
| 548 |
'type' => 'text', |
| 549 |
'title' => esc_html__( 'Cart item description text', 'merchant' ), |
| 550 |
'default' => esc_html__( 'This item was added as a free gift', 'merchant' ), |
| 551 |
'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ), |
| 552 |
), |
| 553 |
|
| 554 |
array( |
| 555 |
'id' => 'tiered_free_gifts', |
| 556 |
'type' => 'switcher', |
| 557 |
'title' => esc_html__( 'Tiered free gifts', 'merchant' ), |
| 558 |
'desc' => esc_html__( 'Customers can claim one free gift per order. Selecting a new gift automatically replaces any previously chosen gift.', 'merchant' ), |
| 559 |
'default' => 0, |
| 560 |
), |
| 561 |
), |
| 562 |
) ); |
| 563 |
|
| 564 |
// Gift Widget Settings |
| 565 |
Merchant_Admin_Options::create( array( |
| 566 |
'title' => esc_html__( 'Gift Widget', 'merchant' ), |
| 567 |
'module' => Merchant_Free_Gifts::MODULE_ID, |
| 568 |
'fields' => array( |
| 569 |
array( |
| 570 |
'id' => 'icon', |
| 571 |
'type' => 'choices', |
| 572 |
'title' => esc_html__( 'Widget icon', 'merchant' ), |
| 573 |
'options' => array( |
| 574 |
'gifts-icon-1' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-1.svg', |
| 575 |
'gifts-icon-2' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-2.svg', |
| 576 |
'gifts-icon-3' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-3.svg', |
| 577 |
'gifts-icon-4' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-4.svg', |
| 578 |
'gifts-icon-5' => MERCHANT_URI . 'assets/images/icons/free-gifts/icon-5.svg', |
| 579 |
), |
| 580 |
'default' => 'gifts-icon-1', |
| 581 |
), |
| 582 |
|
| 583 |
array( |
| 584 |
'id' => 'position', |
| 585 |
'type' => 'select', |
| 586 |
'title' => esc_html__( 'Position', 'merchant' ), |
| 587 |
'options' => array( |
| 588 |
'top_right' => esc_html__( 'Top Right', 'merchant' ), |
| 589 |
'top_left' => esc_html__( 'Top Left', 'merchant' ), |
| 590 |
'bottom_right' => esc_html__( 'Bottom Right', 'merchant' ), |
| 591 |
'bottom_left' => esc_html__( 'Bottom Left', 'merchant' ), |
| 592 |
), |
| 593 |
'default' => 'top_right', |
| 594 |
), |
| 595 |
|
| 596 |
array( |
| 597 |
'id' => 'distance', |
| 598 |
'type' => 'range', |
| 599 |
'title' => esc_html__( 'Distance', 'merchant' ), |
| 600 |
'min' => 0, |
| 601 |
'max' => 999, |
| 602 |
'step' => 1, |
| 603 |
'unit' => 'px', |
| 604 |
'default' => 150, |
| 605 |
), |
| 606 |
|
| 607 |
array( |
| 608 |
'id' => 'display_homepage', |
| 609 |
'type' => 'checkbox', |
| 610 |
'title' => esc_html__( 'Show on pages', 'merchant' ), |
| 611 |
'label' => esc_html__( 'Homepage', 'merchant' ), |
| 612 |
'default' => 1, |
| 613 |
), |
| 614 |
|
| 615 |
array( |
| 616 |
'id' => 'display_shop', |
| 617 |
'type' => 'checkbox', |
| 618 |
'label' => esc_html__( 'Shop page', 'merchant' ), |
| 619 |
'default' => 1, |
| 620 |
), |
| 621 |
|
| 622 |
array( |
| 623 |
'id' => 'display_product', |
| 624 |
'type' => 'checkbox', |
| 625 |
'label' => esc_html__( 'Product page', 'merchant' ), |
| 626 |
'default' => 1, |
| 627 |
), |
| 628 |
|
| 629 |
array( |
| 630 |
'id' => 'display_cart', |
| 631 |
'type' => 'checkbox', |
| 632 |
'label' => esc_html__( 'Cart page', 'merchant' ), |
| 633 |
'default' => 1, |
| 634 |
), |
| 635 |
), |
| 636 |
) ); |
| 637 |
|
| 638 |
// Style Settings |
| 639 |
Merchant_Admin_Options::create( array( |
| 640 |
'module' => Merchant_Free_Gifts::MODULE_ID, |
| 641 |
'title' => esc_html__( 'Look and Feel', 'merchant' ), |
| 642 |
'fields' => array( |
| 643 |
array( |
| 644 |
'id' => 'count_bg_color', |
| 645 |
'type' => 'color', |
| 646 |
'title' => esc_html__( 'Count background color', 'merchant' ), |
| 647 |
'default' => '#000', |
| 648 |
), |
| 649 |
|
| 650 |
array( |
| 651 |
'id' => 'count_text_color', |
| 652 |
'type' => 'color', |
| 653 |
'title' => esc_html__( 'Count text color', 'merchant' ), |
| 654 |
'default' => '#fff', |
| 655 |
), |
| 656 |
|
| 657 |
array( |
| 658 |
'id' => 'button_bg_color', |
| 659 |
'type' => 'color', |
| 660 |
'title' => esc_html__( 'Gift button background color', 'merchant' ), |
| 661 |
'default' => '#362e94', |
| 662 |
), |
| 663 |
|
| 664 |
array( |
| 665 |
'id' => 'button_hover_bg_color', |
| 666 |
'type' => 'color', |
| 667 |
'title' => esc_html__( 'Gift button Hover background color', 'merchant' ), |
| 668 |
'default' => '#7167e1', |
| 669 |
), |
| 670 |
|
| 671 |
array( |
| 672 |
'id' => 'button_text_color', |
| 673 |
'type' => 'color', |
| 674 |
'title' => esc_html__( 'Gift button Icon color', 'merchant' ), |
| 675 |
'default' => '#fff', |
| 676 |
), |
| 677 |
|
| 678 |
array( |
| 679 |
'id' => 'content_width', |
| 680 |
'type' => 'range', |
| 681 |
'title' => esc_html__( 'Content width', 'merchant' ), |
| 682 |
'min' => 0, |
| 683 |
'max' => 600, |
| 684 |
'step' => 1, |
| 685 |
'unit' => 'px', |
| 686 |
'default' => 300, |
| 687 |
), |
| 688 |
|
| 689 |
array( |
| 690 |
'id' => 'mobile_width', |
| 691 |
'type' => 'checkbox', |
| 692 |
'label' => esc_html__( 'Mobile width', 'merchant' ), |
| 693 |
'default' => 0, |
| 694 |
), |
| 695 |
|
| 696 |
array( |
| 697 |
'id' => 'content_width_mobile', |
| 698 |
'type' => 'range', |
| 699 |
'title' => esc_html__( 'Content width', 'merchant' ), |
| 700 |
'min' => 0, |
| 701 |
'max' => 600, |
| 702 |
'step' => 1, |
| 703 |
'unit' => 'px', |
| 704 |
'default' => 300, |
| 705 |
'condition' => array( 'mobile_width', '==', '1' ), |
| 706 |
), |
| 707 |
|
| 708 |
array( |
| 709 |
'id' => 'content_bg_color', |
| 710 |
'type' => 'color', |
| 711 |
'title' => esc_html__( 'Content background color', 'merchant' ), |
| 712 |
'default' => '#fff', |
| 713 |
), |
| 714 |
|
| 715 |
array( |
| 716 |
'id' => 'label_bg_color', |
| 717 |
'type' => 'color', |
| 718 |
'title' => esc_html__( 'Label background color', 'merchant' ), |
| 719 |
'default' => '#f5f5f5', |
| 720 |
), |
| 721 |
|
| 722 |
array( |
| 723 |
'id' => 'label_text_color', |
| 724 |
'type' => 'color', |
| 725 |
'title' => esc_html__( 'Label text color', 'merchant' ), |
| 726 |
'default' => '#212121', |
| 727 |
), |
| 728 |
|
| 729 |
array( |
| 730 |
'id' => 'product_text_color', |
| 731 |
'type' => 'color', |
| 732 |
'title' => esc_html__( 'Product text color', 'merchant' ), |
| 733 |
'default' => '#212121', |
| 734 |
), |
| 735 |
|
| 736 |
array( |
| 737 |
'id' => 'product_text_hover_color', |
| 738 |
'type' => 'color', |
| 739 |
'title' => esc_html__( 'Product hover text color', 'merchant' ), |
| 740 |
'default' => '#757575', |
| 741 |
), |
| 742 |
|
| 743 |
array( |
| 744 |
'id' => 'product_price_text_color', |
| 745 |
'type' => 'color', |
| 746 |
'title' => esc_html__( 'Product price text color', 'merchant' ), |
| 747 |
'default' => '#999999', |
| 748 |
), |
| 749 |
|
| 750 |
array( |
| 751 |
'id' => 'free_text_color', |
| 752 |
'type' => 'color', |
| 753 |
'title' => esc_html__( 'Gift price label color', 'merchant' ), |
| 754 |
'default' => '#212121', |
| 755 |
), |
| 756 |
), |
| 757 |
) |
| 758 |
); |
| 759 |
|