Discount Rules for WooCommerce - Version 2.2.2

Version Description

  • 24/09/20 =
  • Feature - Apply as coupon option.
  • Fix - You saved message not showing on backend order page.
  • Fix - Variable product strike through not working with suppress third party option.
  • Fix - Disable strikeout when save product through backend inline method.
  • Fix - Case sensitive issue on email based rules.
  • Fix - Loading multiple fields for custom taxonomy.
  • Improvement - Rule not saving when zero prices are entered in bulk discount.
  • Improvement - Wholesale price by RymeraWebCo compatible improvement.
  • Improvement - Event advanced_woo_discount_rules_hide_specific_rules_in_bulk_table added additional parameter.
  • Improvement - Translation for you saved text and applied rule messages.
  • Improvement - Disable strikeout when no option is chosen.
  • Improvement - BOGO auto add improved.
Download this release

Release Info

Developer flycart
Plugin Icon 128x128 Discount Rules for WooCommerce
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2

common.php CHANGED
@@ -233,3 +233,12 @@ if(!function_exists('awdr_check_compatible')){
233
  }
234
  }
235
  }
 
 
 
 
 
 
 
 
 
233
  }
234
  }
235
  }
236
+
237
+ /**
238
+ * For plugin translation
239
+ * */
240
+ add_action( 'plugins_loaded', function (){
241
+ if(function_exists('load_plugin_textdomain')){
242
+ load_plugin_textdomain( 'woo-discount-rules', FALSE, basename( dirname( __FILE__ ) ) . '/i18n/languages/' );
243
+ }
244
+ });
i18n/languages/woo-discount-rules.pot CHANGED
@@ -18,29 +18,29 @@ msgstr ""
18
  msgid "Authentication required"
19
  msgstr ""
20
 
21
- #: common.php:16
22
  msgid "Invalid request"
23
  msgstr ""
24
 
25
- #: common.php:22
26
  msgid "Discount Rules 2.0 requires minimum PHP version of "
27
  msgstr ""
28
 
29
- #: common.php:26
30
  msgid "Discount Rules 2.0 requires at least Woocommerce"
31
  msgstr ""
32
 
33
- #: common.php:53
34
  msgid ""
35
  "<p>Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
36
  "activated.</p>"
37
  msgstr ""
38
 
39
- #: common.php:54
40
  msgid "<p><b>Why we made this change?</b></p>"
41
  msgstr ""
42
 
43
- #: common.php:55
44
  msgid ""
45
  "<p>This arrangement is to avoid the confusion in the installation and "
46
  "upgrade process. Many users first install the core free version. Then "
@@ -50,16 +50,16 @@ msgid ""
50
  "end users.</p>"
51
  msgstr ""
52
 
53
- #: common.php:56
54
  msgid ""
55
  "<p>As a result, starting from 2.0, we now have two packs: 1. Core 2. PRO.</p>"
56
  msgstr ""
57
 
58
- #: common.php:57
59
  msgid "Download and Install"
60
  msgstr ""
61
 
62
- #: common.php:60
63
  msgid ""
64
  "Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
65
  "activated. Please download the Pro 2.0 pack from My Downloads page in our "
@@ -69,45 +69,45 @@ msgid ""
69
  "target=\"_blank\">Here is a guide and video tutorial</a>"
70
  msgstr ""
71
 
72
- #: common.php:83
73
  msgid ""
74
  "Switch to Discount Rules V2 which comes with a better UI and advanced "
75
  "rules. (You can switch back any time. Your settings and rules in V1 are "
76
  "kept as is)"
77
  msgstr ""
78
 
79
- #: common.php:84
80
  msgid "Switch to v2"
81
  msgstr ""
82
 
83
- #: common.php:87
84
  msgid "Would you like to switch to older Woo Discount Rules?"
85
  msgstr ""
86
 
87
- #: common.php:88
88
  msgid "Click here to Switch back"
89
  msgstr ""
90
 
91
- #: common.php:98
92
  msgid "Install 2.0 Pro package"
93
  msgstr ""
94
 
95
- #: common.php:120
96
  msgid "Switch back to Discount Rules 1.x"
97
  msgstr ""
98
 
99
- #: common.php:207
100
  msgid ""
101
  "This plugin can not be activated because it requires minimum PHP version of "
102
  msgstr ""
103
 
104
- #: common.php:210
105
  msgid ""
106
  "Woocommerce must installed and activated in-order to use Advanced woo "
107
  "discount rules!"
108
  msgstr ""
109
 
110
- #: common.php:213
111
  msgid " Advanced woo discount rules requires at least Woocommerce"
112
  msgstr ""
113
 
@@ -124,31 +124,31 @@ msgstr ""
124
  msgid "Redirecting to v2 please wait.."
125
  msgstr ""
126
 
127
- #: updater.php:142 updater.php:307 v1/helper/purchase.php:62
128
  #: v1/helper/purchase.php:66 v1/helper/purchase.php:134
129
  #: v1/helper/purchase.php:137 v1/helper/purchase.php:175
130
  msgid "Please enter a valid license key"
131
  msgstr ""
132
 
133
- #: updater.php:145 v1/helper/purchase.php:184
134
  msgid "License key check : Passed."
135
  msgstr ""
136
 
137
- #: updater.php:147 v1/helper/purchase.php:188 v1/view/settings_general.php:32
138
  msgid "License key seems to be Invalid. Please enter a valid license key"
139
  msgstr ""
140
 
141
- #: updater.php:308 v1/helper/purchase.php:62 v1/helper/purchase.php:66
142
  #: v1/helper/purchase.php:134 v1/helper/purchase.php:137
143
  msgid "our website"
144
  msgstr ""
145
 
146
- #: updater.php:312
147
  #, php-format
148
  msgid "License key for the %s seems invalid. %s, you can get it from %s"
149
  msgstr ""
150
 
151
- #: updater.php:316
152
  #, php-format
153
  msgid "License key for the %s is not entered. %s, you can get it from %s"
154
  msgstr ""
@@ -195,8 +195,8 @@ msgstr ""
195
  #: v2/App/Views/Admin/Tabs/settings.php:121
196
  #: v2/App/Views/Admin/Tabs/settings.php:168
197
  #: v2/App/Views/Admin/Tabs/settings.php:239
198
- #: v2/App/Views/Admin/Tabs/settings.php:350
199
- #: v2/App/Views/Admin/Tabs/settings.php:431
200
  msgid "Read Docs"
201
  msgstr ""
202
 
@@ -205,7 +205,7 @@ msgstr ""
205
  msgid "Coupon already exists in WooCommerce. Please select another name"
206
  msgstr ""
207
 
208
- #: v1/helper/general-helper.php:1266 v2/App/Helpers/Helper.php:244
209
  msgid "Invalid token"
210
  msgstr ""
211
 
@@ -316,7 +316,7 @@ msgstr ""
316
  #: v1/view/settings_promotion.php:22 v1/view/settings_promotion.php:62
317
  #: v1/view/settings_promotion.php:97 v1/view/settings_promotion.php:132
318
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:252
319
- #: v2/App/Views/Admin/Tabs/settings.php:354
320
  msgid "Disabled"
321
  msgstr ""
322
 
@@ -684,7 +684,7 @@ msgid "Shipping zip code"
684
  msgstr ""
685
 
686
  #: v1/includes/discount-base.php:1156 v1/view/view-cart-rules.php:365
687
- #: v1/view/view-pricing-rules.php:536 v2/App/Helpers/Helper.php:158
688
  #: v2/App/Helpers/ProOptions.php:192 v2/App/Helpers/ProOptions.php:200
689
  #: v2/App/Helpers/ProOptions.php:208 v2/App/Helpers/ProOptions.php:216
690
  #: v2/App/Helpers/ProOptions.php:224 v2/App/Helpers/ProOptions.php:232
@@ -778,7 +778,7 @@ msgstr ""
778
  #: v1/includes/discount-base.php:1173 v1/view/settings_price_rules.php:208
779
  #: v1/view/settings_price_rules.php:226 v1/view/settings_price_rules.php:244
780
  #: v1/view/settings_price_rules.php:262
781
- #: v2/App/Views/Admin/Tabs/settings.php:533
782
  msgid "Show"
783
  msgstr ""
784
 
@@ -1016,7 +1016,8 @@ msgid ""
1016
  "defined in WooCommerce -> Attributes. <a href=\"%s\">Read docs</a>.</span>"
1017
  msgstr ""
1018
 
1019
- #: v1/includes/discount-base.php:1302 v2/App/Controllers/ManageDiscount.php:849
 
1020
  #, php-format
1021
  msgid ""
1022
  "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
@@ -1413,7 +1414,7 @@ msgid ""
1413
  "conditions"
1414
  msgstr ""
1415
 
1416
- #: v1/view/documentation.php:72 v2/App/Helpers/Helper.php:166
1417
  msgid "Category Combination"
1418
  msgstr ""
1419
 
@@ -1494,7 +1495,7 @@ msgstr ""
1494
  msgid "Performance"
1495
  msgstr ""
1496
 
1497
- #: v1/view/settings.php:42 v2/App/Views/Admin/Tabs/settings.php:310
1498
  msgid "Promotion"
1499
  msgstr ""
1500
 
@@ -1619,9 +1620,9 @@ msgstr ""
1619
  #: v2/App/Views/Admin/Tabs/settings.php:101
1620
  #: v2/App/Views/Admin/Tabs/settings.php:173
1621
  #: v2/App/Views/Admin/Tabs/settings.php:268
1622
- #: v2/App/Views/Admin/Tabs/settings.php:285
1623
- #: v2/App/Views/Admin/Tabs/settings.php:323
1624
- #: v2/App/Views/Admin/Tabs/settings.php:381
1625
  msgid "Yes"
1626
  msgstr ""
1627
 
@@ -1635,9 +1636,9 @@ msgstr ""
1635
  #: v2/App/Views/Admin/Tabs/settings.php:105
1636
  #: v2/App/Views/Admin/Tabs/settings.php:176
1637
  #: v2/App/Views/Admin/Tabs/settings.php:272
1638
- #: v2/App/Views/Admin/Tabs/settings.php:291
1639
- #: v2/App/Views/Admin/Tabs/settings.php:329
1640
- #: v2/App/Views/Admin/Tabs/settings.php:386
1641
  msgid "No"
1642
  msgstr ""
1643
 
@@ -1766,7 +1767,7 @@ msgstr ""
1766
  #: v1/view/settings_price_rules.php:137 v1/view/settings_price_rules.php:211
1767
  #: v1/view/settings_price_rules.php:229 v1/view/settings_price_rules.php:247
1768
  #: v1/view/settings_price_rules.php:265
1769
- #: v2/App/Views/Admin/Tabs/settings.php:536
1770
  msgid "Don't Show"
1771
  msgstr ""
1772
 
@@ -1875,19 +1876,19 @@ msgstr ""
1875
  msgid "Display savings text (for price rules)"
1876
  msgstr ""
1877
 
1878
- #: v1/view/settings_promotion.php:25 v2/App/Views/Admin/Tabs/settings.php:355
1879
  msgid "On each line item"
1880
  msgstr ""
1881
 
1882
- #: v1/view/settings_promotion.php:28 v2/App/Views/Admin/Tabs/settings.php:356
1883
  msgid "On after total"
1884
  msgstr ""
1885
 
1886
- #: v1/view/settings_promotion.php:31 v2/App/Views/Admin/Tabs/settings.php:357
1887
  msgid "Both in line item and after total"
1888
  msgstr ""
1889
 
1890
- #: v1/view/settings_promotion.php:39 v2/App/Views/Admin/Tabs/settings.php:364
1891
  msgid "Savings text to show"
1892
  msgstr ""
1893
 
@@ -1923,19 +1924,19 @@ msgid ""
1923
  "discounts)"
1924
  msgstr ""
1925
 
1926
- #: v1/view/settings_promotion.php:134 v2/App/Views/Admin/Tabs/settings.php:340
1927
  msgid "Shop page"
1928
  msgstr ""
1929
 
1930
- #: v1/view/settings_promotion.php:137 v2/App/Views/Admin/Tabs/settings.php:341
1931
  msgid "Product page"
1932
  msgstr ""
1933
 
1934
- #: v1/view/settings_promotion.php:140 v2/App/Views/Admin/Tabs/settings.php:342
1935
  msgid "Cart page"
1936
  msgstr ""
1937
 
1938
- #: v1/view/settings_promotion.php:143 v2/App/Views/Admin/Tabs/settings.php:343
1939
  msgid "Checkout page"
1940
  msgstr ""
1941
 
@@ -2370,7 +2371,8 @@ msgstr ""
2370
  msgid "Do not use"
2371
  msgstr ""
2372
 
2373
- #: v1/view/view-pricing-rules.php:394 v2/App/Helpers/Helper.php:164
 
2374
  msgid "Coupon"
2375
  msgstr ""
2376
 
@@ -2395,7 +2397,7 @@ msgid "Make sure you have created the coupon already"
2395
  msgstr ""
2396
 
2397
  #: v1/view/view-pricing-rules.php:484 v2/App/Conditions/CartSubTotal.php:17
2398
- #: v2/App/Helpers/Helper.php:155
2399
  msgid "Subtotal"
2400
  msgstr ""
2401
 
@@ -2666,7 +2668,7 @@ msgid "Copied!"
2666
  msgstr ""
2667
 
2668
  #: v2/App/Controllers/Admin/Settings.php:433
2669
- #: v2/App/Views/Admin/Tabs/settings.php:496
2670
  msgid "Copy ShortCode"
2671
  msgstr ""
2672
 
@@ -3022,47 +3024,57 @@ msgstr ""
3022
  msgid "Bulk Discount"
3023
  msgstr ""
3024
 
3025
- #: v2/App/Controllers/ManageDiscount.php:663
3026
- msgid "cart discount"
 
3027
  msgstr ""
3028
 
3029
- #: v2/App/Controllers/ManageDiscount.php:863
3030
  msgid "Coupon code applied successfully."
3031
  msgstr ""
3032
 
3033
- #: v2/App/Helpers/Helper.php:150
 
 
 
 
 
 
 
 
 
3034
  msgid "Include additional conditions (if necessary)"
3035
  msgstr ""
3036
 
3037
- #: v2/App/Helpers/Helper.php:151
3038
  msgid "Popular conditions:"
3039
  msgstr ""
3040
 
3041
- #: v2/App/Helpers/Helper.php:156
3042
  msgid "User role"
3043
  msgstr ""
3044
 
3045
- #: v2/App/Helpers/Helper.php:157
3046
  msgid "Days & Time"
3047
  msgstr ""
3048
 
3049
- #: v2/App/Helpers/Helper.php:159
3050
  msgid "Payment Method"
3051
  msgstr ""
3052
 
3053
- #: v2/App/Helpers/Helper.php:165
3054
  msgid "Shipping Address"
3055
  msgstr ""
3056
 
3057
- #: v2/App/Helpers/Helper.php:167
3058
  msgid "Product Combination"
3059
  msgstr ""
3060
 
3061
- #: v2/App/Helpers/Helper.php:168
3062
  msgid "Quantities/Line items"
3063
  msgstr ""
3064
 
3065
- #: v2/App/Helpers/Helper.php:182
3066
  msgid ""
3067
  "Individual Product : \n"
3068
  " This counts the total quantity of each product / line item "
@@ -3077,7 +3089,7 @@ msgid ""
3077
  "variant because WooCommerce considers a variant as a product itself."
3078
  msgstr ""
3079
 
3080
- #: v2/App/Helpers/Helper.php:197
3081
  msgid ""
3082
  "Filter set above :\n"
3083
  " This will count the quantities of products set in the 'Filter' "
@@ -3091,7 +3103,7 @@ msgid ""
3091
  "1 quantity each of X, Y and Z from Category A, then the count here is 3."
3092
  msgstr ""
3093
 
3094
- #: v2/App/Helpers/Helper.php:209
3095
  msgid ""
3096
  "All variants in each product together :\n"
3097
  " Useful when applying discounts based on variable products and "
@@ -3102,11 +3114,11 @@ msgid ""
3102
  "Medium, 6 of Product A - Large, then the count will be: 6+4+2 = 12\n"
3103
  msgstr ""
3104
 
3105
- #: v2/App/Helpers/Helper.php:258
3106
  msgid "Update now"
3107
  msgstr ""
3108
 
3109
- #: v2/App/Helpers/Helper.php:263
3110
  #, php-format
3111
  msgid ""
3112
  "You are using a lower version of our <b>Woo Discount Rules PRO 2.0</b> "
@@ -3279,50 +3291,50 @@ msgstr ""
3279
  msgid "Bundle (Set) Discount - PRO -"
3280
  msgstr ""
3281
 
3282
- #: v2/App/Helpers/Rule.php:1175 v2/App/Helpers/Rule.php:1186
3283
  msgid "discount"
3284
  msgstr ""
3285
 
3286
- #: v2/App/Helpers/Rule.php:1246 v2/App/Helpers/Rule.php:1346
3287
  #: v2/App/Views/Admin/Tabs/ImportExport.php:99
3288
  msgid "Untitled Rule"
3289
  msgstr ""
3290
 
3291
- #: v2/App/Helpers/Validation.php:137 v2/App/Helpers/Validation.php:142
3292
- #: v2/App/Helpers/Validation.php:308
3293
  msgid "Invalid characters"
3294
  msgstr ""
3295
 
3296
- #: v2/App/Helpers/Validation.php:138
3297
  msgid ""
3298
  "Accepts only letters a-z, numbers 0-9 and spaces with special characters"
3299
  msgstr ""
3300
 
3301
- #: v2/App/Helpers/Validation.php:139
3302
  msgid "Accepts only numbers 0-9 and one dot"
3303
  msgstr ""
3304
 
3305
- #: v2/App/Helpers/Validation.php:140
3306
  msgid "Accepts only 0 or 1"
3307
  msgstr ""
3308
 
3309
- #: v2/App/Helpers/Validation.php:141
3310
  msgid "Accepts only hex color code"
3311
  msgstr ""
3312
 
3313
- #: v2/App/Helpers/Validation.php:309
3314
  msgid "Accept only yes, on, 1, true"
3315
  msgstr ""
3316
 
3317
- #: v2/App/Helpers/Validation.php:310
3318
  msgid "Should not contain any tags"
3319
  msgstr ""
3320
 
3321
- #: v2/App/Helpers/Validation.php:311
3322
  msgid "Should not contain any tags and special characters"
3323
  msgstr ""
3324
 
3325
- #: v2/App/Helpers/Validation.php:433
3326
  msgid "Validation error"
3327
  msgstr ""
3328
 
@@ -3604,7 +3616,7 @@ msgid "Preview"
3604
  msgstr ""
3605
 
3606
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:22
3607
- #: v2/App/Views/Admin/Tabs/settings.php:517
3608
  msgid "Note:"
3609
  msgstr ""
3610
 
@@ -3724,16 +3736,16 @@ msgstr ""
3724
  msgid "Discount Type"
3725
  msgstr ""
3726
 
3727
- #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:65
3728
- #: v2/App/Views/Admin/Tabs/settings.php:583
3729
  msgid "Discount Value"
3730
  msgstr ""
3731
 
3732
- #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:70
3733
  msgid "Label"
3734
  msgstr ""
3735
 
3736
- #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:74
3737
  msgid "Title column For Bulk Table"
3738
  msgstr ""
3739
 
@@ -4312,7 +4324,7 @@ msgid "Show discount table on product page"
4312
  msgstr ""
4313
 
4314
  #: v2/App/Views/Admin/Tabs/settings.php:177
4315
- #: v2/App/Views/Admin/Tabs/settings.php:513
4316
  msgid "Customize Discount Table"
4317
  msgstr ""
4318
 
@@ -4389,91 +4401,103 @@ msgid "Show price strikeout on cart"
4389
  msgstr ""
4390
 
4391
  #: v2/App/Views/Admin/Tabs/settings.php:277
4392
- msgid "Combine all cart discounts"
4393
  msgstr ""
4394
 
4395
  #: v2/App/Views/Admin/Tabs/settings.php:278
 
 
 
 
 
 
 
 
 
 
 
 
4396
  msgid "Combine all cart discounts in single discount label"
4397
  msgstr ""
4398
 
4399
- #: v2/App/Views/Admin/Tabs/settings.php:297
4400
- #: v2/App/Views/Admin/Tabs/settings.php:298
4401
  msgid "Discount label for combined discounts"
4402
  msgstr ""
4403
 
4404
- #: v2/App/Views/Admin/Tabs/settings.php:315
4405
  msgid "Subtotal based promotion"
4406
  msgstr ""
4407
 
4408
- #: v2/App/Views/Admin/Tabs/settings.php:316
4409
  msgid ""
4410
  "Display subtotal based promotion messages in cart/product/shop pages<br>If "
4411
  "enabled an option to add promotion message will displays on each rule(when "
4412
  "subtotal condition is added)"
4413
  msgstr ""
4414
 
4415
- #: v2/App/Views/Admin/Tabs/settings.php:334
4416
  msgid "Subtotal based promo text"
4417
  msgstr ""
4418
 
4419
- #: v2/App/Views/Admin/Tabs/settings.php:335
4420
  msgid ""
4421
  "Subtotal based promo text (available only for subtotal based discounts) "
4422
  msgstr ""
4423
 
4424
- #: v2/App/Views/Admin/Tabs/settings.php:339
4425
  msgid "Select the page to display promotion message"
4426
  msgstr ""
4427
 
4428
- #: v2/App/Views/Admin/Tabs/settings.php:349
4429
  msgid "Display you saved text"
4430
  msgstr ""
4431
 
4432
- #: v2/App/Views/Admin/Tabs/settings.php:350
4433
  msgid "Display you saved text when rule applied"
4434
  msgstr ""
4435
 
4436
- #: v2/App/Views/Admin/Tabs/settings.php:365
4437
  msgid "You save text to show when rule applied"
4438
  msgstr ""
4439
 
4440
- #: v2/App/Views/Admin/Tabs/settings.php:374
4441
  msgid "Show a discount applied message on cart?"
4442
  msgstr ""
4443
 
4444
- #: v2/App/Views/Admin/Tabs/settings.php:375
4445
  msgid "Show message in cart page on rule applied"
4446
  msgstr ""
4447
 
4448
- #: v2/App/Views/Admin/Tabs/settings.php:391
4449
  msgid "Applied rule message text on cart"
4450
  msgstr ""
4451
 
4452
- #: v2/App/Views/Admin/Tabs/settings.php:392
4453
  msgid "Text to show when rule applied"
4454
  msgstr ""
4455
 
4456
- #: v2/App/Views/Admin/Tabs/settings.php:431
4457
  msgid "On-Sale page"
4458
  msgstr ""
4459
 
4460
- #: v2/App/Views/Admin/Tabs/settings.php:437
4461
  msgid "Select rules for the On Sale Page"
4462
  msgstr ""
4463
 
4464
- #: v2/App/Views/Admin/Tabs/settings.php:451
4465
  msgid "Type the name of the rule to select it"
4466
  msgstr ""
4467
 
4468
- #: v2/App/Views/Admin/Tabs/settings.php:459
4469
  msgid "All active rules"
4470
  msgstr ""
4471
 
4472
- #: v2/App/Views/Admin/Tabs/settings.php:483
4473
  msgid "Save and Build Index"
4474
  msgstr ""
4475
 
4476
- #: v2/App/Views/Admin/Tabs/settings.php:485
4477
  msgid ""
4478
  "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
4479
  "woocommerce-discount-rules?utm_source=woo-discount-rules-"
@@ -4481,137 +4505,141 @@ msgid ""
4481
  "target='_blank'>Upgrading to Pro</a>"
4482
  msgstr ""
4483
 
4484
- #: v2/App/Views/Admin/Tabs/settings.php:493
4485
  msgid ""
4486
  "ShortCode to load all products which has discount through Woo Discount Rules"
4487
  msgstr ""
4488
 
4489
- #: v2/App/Views/Admin/Tabs/settings.php:516
4490
  msgid "Settings Saved"
4491
  msgstr ""
4492
 
4493
- #: v2/App/Views/Admin/Tabs/settings.php:517
 
 
 
 
4494
  msgid " This table contains sample content for design purpose."
4495
  msgstr ""
4496
 
4497
- #: v2/App/Views/Admin/Tabs/settings.php:527
4498
  msgid "Table Header"
4499
  msgstr ""
4500
 
4501
- #: v2/App/Views/Admin/Tabs/settings.php:528
4502
  msgid "Show/Hide table header column names"
4503
  msgstr ""
4504
 
4505
- #: v2/App/Views/Admin/Tabs/settings.php:541
4506
  msgid "Title column Name on table"
4507
  msgstr ""
4508
 
4509
- #: v2/App/Views/Admin/Tabs/settings.php:542
4510
  msgid "Give name for rule title column"
4511
  msgstr ""
4512
 
4513
- #: v2/App/Views/Admin/Tabs/settings.php:553
4514
  msgid "Discount column Name on table"
4515
  msgstr ""
4516
 
4517
- #: v2/App/Views/Admin/Tabs/settings.php:554
4518
  msgid "Give name for discount column"
4519
  msgstr ""
4520
 
4521
- #: v2/App/Views/Admin/Tabs/settings.php:565
4522
  msgid "Range column Name on table"
4523
  msgstr ""
4524
 
4525
- #: v2/App/Views/Admin/Tabs/settings.php:566
4526
  msgid "Give name for range column"
4527
  msgstr ""
4528
 
4529
- #: v2/App/Views/Admin/Tabs/settings.php:577
4530
  msgid "Discount column value on table"
4531
  msgstr ""
4532
 
4533
- #: v2/App/Views/Admin/Tabs/settings.php:578
4534
  msgid "Show Discount value/price in table"
4535
  msgstr ""
4536
 
4537
- #: v2/App/Views/Admin/Tabs/settings.php:586
4538
  msgid "Discounted Price"
4539
  msgstr ""
4540
 
4541
- #: v2/App/Views/Admin/Tabs/settings.php:661
4542
- #: v2/App/Views/Admin/Tabs/settings.php:684
4543
  msgid "Bulk Rule"
4544
  msgstr ""
4545
 
4546
- #: v2/App/Views/Admin/Tabs/settings.php:669
4547
- #: v2/App/Views/Admin/Tabs/settings.php:715
4548
- #: v2/App/Views/Admin/Tabs/settings.php:782
4549
  #: v2/App/Views/Templates/discount_table.php:116
4550
  msgid " flat"
4551
  msgstr ""
4552
 
4553
- #: v2/App/Views/Admin/Tabs/settings.php:675
4554
  msgid "1 - 5"
4555
  msgstr ""
4556
 
4557
- #: v2/App/Views/Admin/Tabs/settings.php:698
4558
  msgid "11 - 15"
4559
  msgstr ""
4560
 
4561
- #: v2/App/Views/Admin/Tabs/settings.php:707
4562
  msgid "Bulk Flat discount"
4563
  msgstr ""
4564
 
4565
- #: v2/App/Views/Admin/Tabs/settings.php:721
4566
  msgid "50 - 60"
4567
  msgstr ""
4568
 
4569
- #: v2/App/Views/Admin/Tabs/settings.php:730
4570
  msgid "Bulk percentage discount"
4571
  msgstr ""
4572
 
4573
- #: v2/App/Views/Admin/Tabs/settings.php:743
4574
  msgid "70 - 80"
4575
  msgstr ""
4576
 
4577
- #: v2/App/Views/Admin/Tabs/settings.php:752
4578
  #, php-format
4579
  msgid "Bulk % discount"
4580
  msgstr ""
4581
 
4582
- #: v2/App/Views/Admin/Tabs/settings.php:765
4583
  msgid "450 - 500"
4584
  msgstr ""
4585
 
4586
- #: v2/App/Views/Admin/Tabs/settings.php:774
4587
  msgid "Bulk flat"
4588
  msgstr ""
4589
 
4590
- #: v2/App/Views/Admin/Tabs/settings.php:788
4591
  msgid "600 - 700"
4592
  msgstr ""
4593
 
4594
- #: v2/App/Views/Admin/Tabs/settings.php:797
4595
  msgid "set percentage discount"
4596
  msgstr ""
4597
 
4598
- #: v2/App/Views/Admin/Tabs/settings.php:810
4599
  msgid "5"
4600
  msgstr ""
4601
 
4602
- #: v2/App/Views/Admin/Tabs/settings.php:819
4603
  msgid "Fixed discount for set"
4604
  msgstr ""
4605
 
4606
- #: v2/App/Views/Admin/Tabs/settings.php:832
4607
  msgid "10"
4608
  msgstr ""
4609
 
4610
- #: v2/App/Views/Admin/Tabs/settings.php:841
4611
  msgid "set flat discount"
4612
  msgstr ""
4613
 
4614
- #: v2/App/Views/Admin/Tabs/settings.php:854
4615
  msgid "15"
4616
  msgstr ""
4617
 
18
  msgid "Authentication required"
19
  msgstr ""
20
 
21
+ #: common.php:17
22
  msgid "Invalid request"
23
  msgstr ""
24
 
25
+ #: common.php:28
26
  msgid "Discount Rules 2.0 requires minimum PHP version of "
27
  msgstr ""
28
 
29
+ #: common.php:32
30
  msgid "Discount Rules 2.0 requires at least Woocommerce"
31
  msgstr ""
32
 
33
+ #: common.php:62
34
  msgid ""
35
  "<p>Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
36
  "activated.</p>"
37
  msgstr ""
38
 
39
+ #: common.php:63
40
  msgid "<p><b>Why we made this change?</b></p>"
41
  msgstr ""
42
 
43
+ #: common.php:64
44
  msgid ""
45
  "<p>This arrangement is to avoid the confusion in the installation and "
46
  "upgrade process. Many users first install the core free version. Then "
50
  "end users.</p>"
51
  msgstr ""
52
 
53
+ #: common.php:65
54
  msgid ""
55
  "<p>As a result, starting from 2.0, we now have two packs: 1. Core 2. PRO.</p>"
56
  msgstr ""
57
 
58
+ #: common.php:66
59
  msgid "Download and Install"
60
  msgstr ""
61
 
62
+ #: common.php:69
63
  msgid ""
64
  "Since 2.0, you need BOTH Core and Pro (2.0) packages installed and "
65
  "activated. Please download the Pro 2.0 pack from My Downloads page in our "
69
  "target=\"_blank\">Here is a guide and video tutorial</a>"
70
  msgstr ""
71
 
72
+ #: common.php:92
73
  msgid ""
74
  "Switch to Discount Rules V2 which comes with a better UI and advanced "
75
  "rules. (You can switch back any time. Your settings and rules in V1 are "
76
  "kept as is)"
77
  msgstr ""
78
 
79
+ #: common.php:93
80
  msgid "Switch to v2"
81
  msgstr ""
82
 
83
+ #: common.php:96
84
  msgid "Would you like to switch to older Woo Discount Rules?"
85
  msgstr ""
86
 
87
+ #: common.php:97
88
  msgid "Click here to Switch back"
89
  msgstr ""
90
 
91
+ #: common.php:112
92
  msgid "Install 2.0 Pro package"
93
  msgstr ""
94
 
95
+ #: common.php:139
96
  msgid "Switch back to Discount Rules 1.x"
97
  msgstr ""
98
 
99
+ #: common.php:226
100
  msgid ""
101
  "This plugin can not be activated because it requires minimum PHP version of "
102
  msgstr ""
103
 
104
+ #: common.php:229
105
  msgid ""
106
  "Woocommerce must installed and activated in-order to use Advanced woo "
107
  "discount rules!"
108
  msgstr ""
109
 
110
+ #: common.php:232
111
  msgid " Advanced woo discount rules requires at least Woocommerce"
112
  msgstr ""
113
 
124
  msgid "Redirecting to v2 please wait.."
125
  msgstr ""
126
 
127
+ #: updater.php:143 updater.php:308 v1/helper/purchase.php:62
128
  #: v1/helper/purchase.php:66 v1/helper/purchase.php:134
129
  #: v1/helper/purchase.php:137 v1/helper/purchase.php:175
130
  msgid "Please enter a valid license key"
131
  msgstr ""
132
 
133
+ #: updater.php:146 v1/helper/purchase.php:184
134
  msgid "License key check : Passed."
135
  msgstr ""
136
 
137
+ #: updater.php:148 v1/helper/purchase.php:188 v1/view/settings_general.php:32
138
  msgid "License key seems to be Invalid. Please enter a valid license key"
139
  msgstr ""
140
 
141
+ #: updater.php:309 v1/helper/purchase.php:62 v1/helper/purchase.php:66
142
  #: v1/helper/purchase.php:134 v1/helper/purchase.php:137
143
  msgid "our website"
144
  msgstr ""
145
 
146
+ #: updater.php:313
147
  #, php-format
148
  msgid "License key for the %s seems invalid. %s, you can get it from %s"
149
  msgstr ""
150
 
151
+ #: updater.php:317
152
  #, php-format
153
  msgid "License key for the %s is not entered. %s, you can get it from %s"
154
  msgstr ""
195
  #: v2/App/Views/Admin/Tabs/settings.php:121
196
  #: v2/App/Views/Admin/Tabs/settings.php:168
197
  #: v2/App/Views/Admin/Tabs/settings.php:239
198
+ #: v2/App/Views/Admin/Tabs/settings.php:362
199
+ #: v2/App/Views/Admin/Tabs/settings.php:443
200
  msgid "Read Docs"
201
  msgstr ""
202
 
205
  msgid "Coupon already exists in WooCommerce. Please select another name"
206
  msgstr ""
207
 
208
+ #: v1/helper/general-helper.php:1266 v2/App/Helpers/Helper.php:321
209
  msgid "Invalid token"
210
  msgstr ""
211
 
316
  #: v1/view/settings_promotion.php:22 v1/view/settings_promotion.php:62
317
  #: v1/view/settings_promotion.php:97 v1/view/settings_promotion.php:132
318
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:252
319
+ #: v2/App/Views/Admin/Tabs/settings.php:366
320
  msgid "Disabled"
321
  msgstr ""
322
 
684
  msgstr ""
685
 
686
  #: v1/includes/discount-base.php:1156 v1/view/view-cart-rules.php:365
687
+ #: v1/view/view-pricing-rules.php:536 v2/App/Helpers/Helper.php:162
688
  #: v2/App/Helpers/ProOptions.php:192 v2/App/Helpers/ProOptions.php:200
689
  #: v2/App/Helpers/ProOptions.php:208 v2/App/Helpers/ProOptions.php:216
690
  #: v2/App/Helpers/ProOptions.php:224 v2/App/Helpers/ProOptions.php:232
778
  #: v1/includes/discount-base.php:1173 v1/view/settings_price_rules.php:208
779
  #: v1/view/settings_price_rules.php:226 v1/view/settings_price_rules.php:244
780
  #: v1/view/settings_price_rules.php:262
781
+ #: v2/App/Views/Admin/Tabs/settings.php:546
782
  msgid "Show"
783
  msgstr ""
784
 
1016
  "defined in WooCommerce -> Attributes. <a href=\"%s\">Read docs</a>.</span>"
1017
  msgstr ""
1018
 
1019
+ #: v1/includes/discount-base.php:1302
1020
+ #: v2/App/Controllers/ManageDiscount.php:1111
1021
  #, php-format
1022
  msgid ""
1023
  "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
1414
  "conditions"
1415
  msgstr ""
1416
 
1417
+ #: v1/view/documentation.php:72 v2/App/Helpers/Helper.php:170
1418
  msgid "Category Combination"
1419
  msgstr ""
1420
 
1495
  msgid "Performance"
1496
  msgstr ""
1497
 
1498
+ #: v1/view/settings.php:42 v2/App/Views/Admin/Tabs/settings.php:322
1499
  msgid "Promotion"
1500
  msgstr ""
1501
 
1620
  #: v2/App/Views/Admin/Tabs/settings.php:101
1621
  #: v2/App/Views/Admin/Tabs/settings.php:173
1622
  #: v2/App/Views/Admin/Tabs/settings.php:268
1623
+ #: v2/App/Views/Admin/Tabs/settings.php:297
1624
+ #: v2/App/Views/Admin/Tabs/settings.php:335
1625
+ #: v2/App/Views/Admin/Tabs/settings.php:393
1626
  msgid "Yes"
1627
  msgstr ""
1628
 
1636
  #: v2/App/Views/Admin/Tabs/settings.php:105
1637
  #: v2/App/Views/Admin/Tabs/settings.php:176
1638
  #: v2/App/Views/Admin/Tabs/settings.php:272
1639
+ #: v2/App/Views/Admin/Tabs/settings.php:303
1640
+ #: v2/App/Views/Admin/Tabs/settings.php:341
1641
+ #: v2/App/Views/Admin/Tabs/settings.php:398
1642
  msgid "No"
1643
  msgstr ""
1644
 
1767
  #: v1/view/settings_price_rules.php:137 v1/view/settings_price_rules.php:211
1768
  #: v1/view/settings_price_rules.php:229 v1/view/settings_price_rules.php:247
1769
  #: v1/view/settings_price_rules.php:265
1770
+ #: v2/App/Views/Admin/Tabs/settings.php:549
1771
  msgid "Don't Show"
1772
  msgstr ""
1773
 
1876
  msgid "Display savings text (for price rules)"
1877
  msgstr ""
1878
 
1879
+ #: v1/view/settings_promotion.php:25 v2/App/Views/Admin/Tabs/settings.php:367
1880
  msgid "On each line item"
1881
  msgstr ""
1882
 
1883
+ #: v1/view/settings_promotion.php:28 v2/App/Views/Admin/Tabs/settings.php:368
1884
  msgid "On after total"
1885
  msgstr ""
1886
 
1887
+ #: v1/view/settings_promotion.php:31 v2/App/Views/Admin/Tabs/settings.php:369
1888
  msgid "Both in line item and after total"
1889
  msgstr ""
1890
 
1891
+ #: v1/view/settings_promotion.php:39 v2/App/Views/Admin/Tabs/settings.php:376
1892
  msgid "Savings text to show"
1893
  msgstr ""
1894
 
1924
  "discounts)"
1925
  msgstr ""
1926
 
1927
+ #: v1/view/settings_promotion.php:134 v2/App/Views/Admin/Tabs/settings.php:352
1928
  msgid "Shop page"
1929
  msgstr ""
1930
 
1931
+ #: v1/view/settings_promotion.php:137 v2/App/Views/Admin/Tabs/settings.php:353
1932
  msgid "Product page"
1933
  msgstr ""
1934
 
1935
+ #: v1/view/settings_promotion.php:140 v2/App/Views/Admin/Tabs/settings.php:354
1936
  msgid "Cart page"
1937
  msgstr ""
1938
 
1939
+ #: v1/view/settings_promotion.php:143 v2/App/Views/Admin/Tabs/settings.php:355
1940
  msgid "Checkout page"
1941
  msgstr ""
1942
 
2371
  msgid "Do not use"
2372
  msgstr ""
2373
 
2374
+ #: v1/view/view-pricing-rules.php:394 v2/App/Helpers/Helper.php:168
2375
+ #: v2/App/Views/Admin/Tabs/settings.php:283
2376
  msgid "Coupon"
2377
  msgstr ""
2378
 
2397
  msgstr ""
2398
 
2399
  #: v1/view/view-pricing-rules.php:484 v2/App/Conditions/CartSubTotal.php:17
2400
+ #: v2/App/Helpers/Helper.php:159
2401
  msgid "Subtotal"
2402
  msgstr ""
2403
 
2668
  msgstr ""
2669
 
2670
  #: v2/App/Controllers/Admin/Settings.php:433
2671
+ #: v2/App/Views/Admin/Tabs/settings.php:508
2672
  msgid "Copy ShortCode"
2673
  msgstr ""
2674
 
3024
  msgid "Bulk Discount"
3025
  msgstr ""
3026
 
3027
+ #: v2/App/Controllers/ManageDiscount.php:678
3028
+ #: v2/App/Controllers/ManageDiscount.php:873 v2/App/Helpers/Helper.php:268
3029
+ msgid "Cart discount"
3030
  msgstr ""
3031
 
3032
+ #: v2/App/Controllers/ManageDiscount.php:1125
3033
  msgid "Coupon code applied successfully."
3034
  msgstr ""
3035
 
3036
+ #: v2/App/Controllers/ManageDiscount.php:1532
3037
+ #: v2/App/Views/Admin/Tabs/settings.php:409
3038
+ msgid "Discount <strong>{{title}}</strong> has been applied to your cart."
3039
+ msgstr ""
3040
+
3041
+ #: v2/App/Controllers/ManageDiscount.php:1641
3042
+ msgid "You saved {{total_discount}}"
3043
+ msgstr ""
3044
+
3045
+ #: v2/App/Helpers/Helper.php:154
3046
  msgid "Include additional conditions (if necessary)"
3047
  msgstr ""
3048
 
3049
+ #: v2/App/Helpers/Helper.php:155
3050
  msgid "Popular conditions:"
3051
  msgstr ""
3052
 
3053
+ #: v2/App/Helpers/Helper.php:160
3054
  msgid "User role"
3055
  msgstr ""
3056
 
3057
+ #: v2/App/Helpers/Helper.php:161
3058
  msgid "Days & Time"
3059
  msgstr ""
3060
 
3061
+ #: v2/App/Helpers/Helper.php:163
3062
  msgid "Payment Method"
3063
  msgstr ""
3064
 
3065
+ #: v2/App/Helpers/Helper.php:169
3066
  msgid "Shipping Address"
3067
  msgstr ""
3068
 
3069
+ #: v2/App/Helpers/Helper.php:171
3070
  msgid "Product Combination"
3071
  msgstr ""
3072
 
3073
+ #: v2/App/Helpers/Helper.php:172
3074
  msgid "Quantities/Line items"
3075
  msgstr ""
3076
 
3077
+ #: v2/App/Helpers/Helper.php:186
3078
  msgid ""
3079
  "Individual Product : \n"
3080
  " This counts the total quantity of each product / line item "
3089
  "variant because WooCommerce considers a variant as a product itself."
3090
  msgstr ""
3091
 
3092
+ #: v2/App/Helpers/Helper.php:201
3093
  msgid ""
3094
  "Filter set above :\n"
3095
  " This will count the quantities of products set in the 'Filter' "
3103
  "1 quantity each of X, Y and Z from Category A, then the count here is 3."
3104
  msgstr ""
3105
 
3106
+ #: v2/App/Helpers/Helper.php:213
3107
  msgid ""
3108
  "All variants in each product together :\n"
3109
  " Useful when applying discounts based on variable products and "
3114
  "Medium, 6 of Product A - Large, then the count will be: 6+4+2 = 12\n"
3115
  msgstr ""
3116
 
3117
+ #: v2/App/Helpers/Helper.php:335
3118
  msgid "Update now"
3119
  msgstr ""
3120
 
3121
+ #: v2/App/Helpers/Helper.php:340
3122
  #, php-format
3123
  msgid ""
3124
  "You are using a lower version of our <b>Woo Discount Rules PRO 2.0</b> "
3291
  msgid "Bundle (Set) Discount - PRO -"
3292
  msgstr ""
3293
 
3294
+ #: v2/App/Helpers/Rule.php:1178 v2/App/Helpers/Rule.php:1189
3295
  msgid "discount"
3296
  msgstr ""
3297
 
3298
+ #: v2/App/Helpers/Rule.php:1249 v2/App/Helpers/Rule.php:1349
3299
  #: v2/App/Views/Admin/Tabs/ImportExport.php:99
3300
  msgid "Untitled Rule"
3301
  msgstr ""
3302
 
3303
+ #: v2/App/Helpers/Validation.php:139 v2/App/Helpers/Validation.php:144
3304
+ #: v2/App/Helpers/Validation.php:310
3305
  msgid "Invalid characters"
3306
  msgstr ""
3307
 
3308
+ #: v2/App/Helpers/Validation.php:140
3309
  msgid ""
3310
  "Accepts only letters a-z, numbers 0-9 and spaces with special characters"
3311
  msgstr ""
3312
 
3313
+ #: v2/App/Helpers/Validation.php:141
3314
  msgid "Accepts only numbers 0-9 and one dot"
3315
  msgstr ""
3316
 
3317
+ #: v2/App/Helpers/Validation.php:142
3318
  msgid "Accepts only 0 or 1"
3319
  msgstr ""
3320
 
3321
+ #: v2/App/Helpers/Validation.php:143
3322
  msgid "Accepts only hex color code"
3323
  msgstr ""
3324
 
3325
+ #: v2/App/Helpers/Validation.php:311
3326
  msgid "Accept only yes, on, 1, true"
3327
  msgstr ""
3328
 
3329
+ #: v2/App/Helpers/Validation.php:312
3330
  msgid "Should not contain any tags"
3331
  msgstr ""
3332
 
3333
+ #: v2/App/Helpers/Validation.php:313
3334
  msgid "Should not contain any tags and special characters"
3335
  msgstr ""
3336
 
3337
+ #: v2/App/Helpers/Validation.php:436
3338
  msgid "Validation error"
3339
  msgstr ""
3340
 
3616
  msgstr ""
3617
 
3618
  #: v2/App/Views/Admin/Rules/DiscountBatch/Main.php:22
3619
+ #: v2/App/Views/Admin/Tabs/settings.php:530
3620
  msgid "Note:"
3621
  msgstr ""
3622
 
3736
  msgid "Discount Type"
3737
  msgstr ""
3738
 
3739
+ #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:67
3740
+ #: v2/App/Views/Admin/Tabs/settings.php:596
3741
  msgid "Discount Value"
3742
  msgstr ""
3743
 
3744
+ #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:72
3745
  msgid "Label"
3746
  msgstr ""
3747
 
3748
+ #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:76
3749
  msgid "Title column For Bulk Table"
3750
  msgstr ""
3751
 
4324
  msgstr ""
4325
 
4326
  #: v2/App/Views/Admin/Tabs/settings.php:177
4327
+ #: v2/App/Views/Admin/Tabs/settings.php:525
4328
  msgid "Customize Discount Table"
4329
  msgstr ""
4330
 
4401
  msgstr ""
4402
 
4403
  #: v2/App/Views/Admin/Tabs/settings.php:277
4404
+ msgid "Apply cart discount as"
4405
  msgstr ""
4406
 
4407
  #: v2/App/Views/Admin/Tabs/settings.php:278
4408
+ msgid "Apply cart discount as fee/coupon"
4409
+ msgstr ""
4410
+
4411
+ #: v2/App/Views/Admin/Tabs/settings.php:282
4412
+ msgid "Fee"
4413
+ msgstr ""
4414
+
4415
+ #: v2/App/Views/Admin/Tabs/settings.php:289
4416
+ msgid "Combine all cart discounts"
4417
+ msgstr ""
4418
+
4419
+ #: v2/App/Views/Admin/Tabs/settings.php:290
4420
  msgid "Combine all cart discounts in single discount label"
4421
  msgstr ""
4422
 
4423
+ #: v2/App/Views/Admin/Tabs/settings.php:309
4424
+ #: v2/App/Views/Admin/Tabs/settings.php:310
4425
  msgid "Discount label for combined discounts"
4426
  msgstr ""
4427
 
4428
+ #: v2/App/Views/Admin/Tabs/settings.php:327
4429
  msgid "Subtotal based promotion"
4430
  msgstr ""
4431
 
4432
+ #: v2/App/Views/Admin/Tabs/settings.php:328
4433
  msgid ""
4434
  "Display subtotal based promotion messages in cart/product/shop pages<br>If "
4435
  "enabled an option to add promotion message will displays on each rule(when "
4436
  "subtotal condition is added)"
4437
  msgstr ""
4438
 
4439
+ #: v2/App/Views/Admin/Tabs/settings.php:346
4440
  msgid "Subtotal based promo text"
4441
  msgstr ""
4442
 
4443
+ #: v2/App/Views/Admin/Tabs/settings.php:347
4444
  msgid ""
4445
  "Subtotal based promo text (available only for subtotal based discounts) "
4446
  msgstr ""
4447
 
4448
+ #: v2/App/Views/Admin/Tabs/settings.php:351
4449
  msgid "Select the page to display promotion message"
4450
  msgstr ""
4451
 
4452
+ #: v2/App/Views/Admin/Tabs/settings.php:361
4453
  msgid "Display you saved text"
4454
  msgstr ""
4455
 
4456
+ #: v2/App/Views/Admin/Tabs/settings.php:362
4457
  msgid "Display you saved text when rule applied"
4458
  msgstr ""
4459
 
4460
+ #: v2/App/Views/Admin/Tabs/settings.php:377
4461
  msgid "You save text to show when rule applied"
4462
  msgstr ""
4463
 
4464
+ #: v2/App/Views/Admin/Tabs/settings.php:386
4465
  msgid "Show a discount applied message on cart?"
4466
  msgstr ""
4467
 
4468
+ #: v2/App/Views/Admin/Tabs/settings.php:387
4469
  msgid "Show message in cart page on rule applied"
4470
  msgstr ""
4471
 
4472
+ #: v2/App/Views/Admin/Tabs/settings.php:403
4473
  msgid "Applied rule message text on cart"
4474
  msgstr ""
4475
 
4476
+ #: v2/App/Views/Admin/Tabs/settings.php:404
4477
  msgid "Text to show when rule applied"
4478
  msgstr ""
4479
 
4480
+ #: v2/App/Views/Admin/Tabs/settings.php:443
4481
  msgid "On-Sale page"
4482
  msgstr ""
4483
 
4484
+ #: v2/App/Views/Admin/Tabs/settings.php:449
4485
  msgid "Select rules for the On Sale Page"
4486
  msgstr ""
4487
 
4488
+ #: v2/App/Views/Admin/Tabs/settings.php:463
4489
  msgid "Type the name of the rule to select it"
4490
  msgstr ""
4491
 
4492
+ #: v2/App/Views/Admin/Tabs/settings.php:471
4493
  msgid "All active rules"
4494
  msgstr ""
4495
 
4496
+ #: v2/App/Views/Admin/Tabs/settings.php:495
4497
  msgid "Save and Build Index"
4498
  msgstr ""
4499
 
4500
+ #: v2/App/Views/Admin/Tabs/settings.php:497
4501
  msgid ""
4502
  "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
4503
  "woocommerce-discount-rules?utm_source=woo-discount-rules-"
4505
  "target='_blank'>Upgrading to Pro</a>"
4506
  msgstr ""
4507
 
4508
+ #: v2/App/Views/Admin/Tabs/settings.php:505
4509
  msgid ""
4510
  "ShortCode to load all products which has discount through Woo Discount Rules"
4511
  msgstr ""
4512
 
4513
+ #: v2/App/Views/Admin/Tabs/settings.php:528
4514
  msgid "Settings Saved"
4515
  msgstr ""
4516
 
4517
+ #: v2/App/Views/Admin/Tabs/settings.php:529
4518
+ msgid "Oops! Something went wrong."
4519
+ msgstr ""
4520
+
4521
+ #: v2/App/Views/Admin/Tabs/settings.php:530
4522
  msgid " This table contains sample content for design purpose."
4523
  msgstr ""
4524
 
4525
+ #: v2/App/Views/Admin/Tabs/settings.php:540
4526
  msgid "Table Header"
4527
  msgstr ""
4528
 
4529
+ #: v2/App/Views/Admin/Tabs/settings.php:541
4530
  msgid "Show/Hide table header column names"
4531
  msgstr ""
4532
 
4533
+ #: v2/App/Views/Admin/Tabs/settings.php:554
4534
  msgid "Title column Name on table"
4535
  msgstr ""
4536
 
4537
+ #: v2/App/Views/Admin/Tabs/settings.php:555
4538
  msgid "Give name for rule title column"
4539
  msgstr ""
4540
 
4541
+ #: v2/App/Views/Admin/Tabs/settings.php:566
4542
  msgid "Discount column Name on table"
4543
  msgstr ""
4544
 
4545
+ #: v2/App/Views/Admin/Tabs/settings.php:567
4546
  msgid "Give name for discount column"
4547
  msgstr ""
4548
 
4549
+ #: v2/App/Views/Admin/Tabs/settings.php:578
4550
  msgid "Range column Name on table"
4551
  msgstr ""
4552
 
4553
+ #: v2/App/Views/Admin/Tabs/settings.php:579
4554
  msgid "Give name for range column"
4555
  msgstr ""
4556
 
4557
+ #: v2/App/Views/Admin/Tabs/settings.php:590
4558
  msgid "Discount column value on table"
4559
  msgstr ""
4560
 
4561
+ #: v2/App/Views/Admin/Tabs/settings.php:591
4562
  msgid "Show Discount value/price in table"
4563
  msgstr ""
4564
 
4565
+ #: v2/App/Views/Admin/Tabs/settings.php:599
4566
  msgid "Discounted Price"
4567
  msgstr ""
4568
 
4569
+ #: v2/App/Views/Admin/Tabs/settings.php:674
4570
+ #: v2/App/Views/Admin/Tabs/settings.php:697
4571
  msgid "Bulk Rule"
4572
  msgstr ""
4573
 
4574
+ #: v2/App/Views/Admin/Tabs/settings.php:682
4575
+ #: v2/App/Views/Admin/Tabs/settings.php:728
4576
+ #: v2/App/Views/Admin/Tabs/settings.php:795
4577
  #: v2/App/Views/Templates/discount_table.php:116
4578
  msgid " flat"
4579
  msgstr ""
4580
 
4581
+ #: v2/App/Views/Admin/Tabs/settings.php:688
4582
  msgid "1 - 5"
4583
  msgstr ""
4584
 
4585
+ #: v2/App/Views/Admin/Tabs/settings.php:711
4586
  msgid "11 - 15"
4587
  msgstr ""
4588
 
4589
+ #: v2/App/Views/Admin/Tabs/settings.php:720
4590
  msgid "Bulk Flat discount"
4591
  msgstr ""
4592
 
4593
+ #: v2/App/Views/Admin/Tabs/settings.php:734
4594
  msgid "50 - 60"
4595
  msgstr ""
4596
 
4597
+ #: v2/App/Views/Admin/Tabs/settings.php:743
4598
  msgid "Bulk percentage discount"
4599
  msgstr ""
4600
 
4601
+ #: v2/App/Views/Admin/Tabs/settings.php:756
4602
  msgid "70 - 80"
4603
  msgstr ""
4604
 
4605
+ #: v2/App/Views/Admin/Tabs/settings.php:765
4606
  #, php-format
4607
  msgid "Bulk % discount"
4608
  msgstr ""
4609
 
4610
+ #: v2/App/Views/Admin/Tabs/settings.php:778
4611
  msgid "450 - 500"
4612
  msgstr ""
4613
 
4614
+ #: v2/App/Views/Admin/Tabs/settings.php:787
4615
  msgid "Bulk flat"
4616
  msgstr ""
4617
 
4618
+ #: v2/App/Views/Admin/Tabs/settings.php:801
4619
  msgid "600 - 700"
4620
  msgstr ""
4621
 
4622
+ #: v2/App/Views/Admin/Tabs/settings.php:810
4623
  msgid "set percentage discount"
4624
  msgstr ""
4625
 
4626
+ #: v2/App/Views/Admin/Tabs/settings.php:823
4627
  msgid "5"
4628
  msgstr ""
4629
 
4630
+ #: v2/App/Views/Admin/Tabs/settings.php:832
4631
  msgid "Fixed discount for set"
4632
  msgstr ""
4633
 
4634
+ #: v2/App/Views/Admin/Tabs/settings.php:845
4635
  msgid "10"
4636
  msgstr ""
4637
 
4638
+ #: v2/App/Views/Admin/Tabs/settings.php:854
4639
  msgid "set flat discount"
4640
  msgstr ""
4641
 
4642
+ #: v2/App/Views/Admin/Tabs/settings.php:867
4643
  msgid "15"
4644
  msgstr ""
4645
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
  Tested up to: 5.5
7
- Stable tag: 2.2.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -336,6 +336,20 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  = 2.2.1 - 08/09/20 =
340
  * Fix - Table column doesn't accepts space.
341
  * Fix - Zipcode condition doesn't works on changing in checkout.
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
  Tested up to: 5.5
7
+ Stable tag: 2.2.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
336
 
337
  == Changelog ==
338
 
339
+ = 2.2.2 - 24/09/20 =
340
+ * Feature - Apply as coupon option.
341
+ * Fix - You saved message not showing on backend order page.
342
+ * Fix - Variable product strike through not working with suppress third party option.
343
+ * Fix - Disable strikeout when save product through backend inline method.
344
+ * Fix - Case sensitive issue on email based rules.
345
+ * Fix - Loading multiple fields for custom taxonomy.
346
+ * Improvement - Rule not saving when zero prices are entered in bulk discount.
347
+ * Improvement - Wholesale price by RymeraWebCo compatible improvement.
348
+ * Improvement - Event advanced_woo_discount_rules_hide_specific_rules_in_bulk_table added additional parameter.
349
+ * Improvement - Translation for you saved text and applied rule messages.
350
+ * Improvement - Disable strikeout when no option is chosen.
351
+ * Improvement - BOGO auto add improved.
352
+
353
  = 2.2.1 - 08/09/20 =
354
  * Fix - Table column doesn't accepts space.
355
  * Fix - Zipcode condition doesn't works on changing in checkout.
v2/App/Compatibility/WholesalePricesByRymeraWebCo.php CHANGED
@@ -18,7 +18,7 @@ class WholesalePricesByRymeraWebCo extends Base
18
  add_filter('wwp_filter_wholesale_price_html', function($wholesale_price_html , $price , $product , $user_wholesale_role , $wholesale_price_title_text , $raw_wholesale_price , $source){
19
  global $wdr_comp_disable_strikeout;
20
  $wdr_comp_disable_strikeout[$product->get_id()] = true;
21
- $result = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $price, $product, 1, $raw_wholesale_price);
22
  if($result !== false){
23
  /*To remove the original price strikeout un-comment the next line */
24
  /*$wholesale_price_html = preg_replace('/<del.*<\/del>/', '', $wholesale_price_html);*/
18
  add_filter('wwp_filter_wholesale_price_html', function($wholesale_price_html , $price , $product , $user_wholesale_role , $wholesale_price_title_text , $raw_wholesale_price , $source){
19
  global $wdr_comp_disable_strikeout;
20
  $wdr_comp_disable_strikeout[$product->get_id()] = true;
21
+ $result = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $raw_wholesale_price, $product, 1, $raw_wholesale_price, 'discounted_price', true);
22
  if($result !== false){
23
  /*To remove the original price strikeout un-comment the next line */
24
  /*$wholesale_price_html = preg_replace('/<del.*<\/del>/', '', $wholesale_price_html);*/
v2/App/Controllers/DiscountCalculator.php CHANGED
@@ -79,7 +79,7 @@ class DiscountCalculator extends Base
79
  continue;
80
  }
81
  $rule_id = $rule->getId();
82
- $hide_bulk_table = apply_filters('advanced_woo_discount_rules_hide_specific_rules_in_bulk_table', false, $rule_id, $rule);
83
  if ($hide_bulk_table) {
84
  continue;
85
  }
@@ -738,6 +738,7 @@ class DiscountCalculator extends Base
738
  unset(self::$total_discounts[$matched_item_key]);
739
  self::$total_discounts[$matched_item_key] = $valid_discounts[$matched_item_key];
740
  }
 
741
  $discounted_price = $product_price - $discount_price;
742
  if ($discounted_price < 0 ) {
743
  $discounted_price = 0;
@@ -963,6 +964,7 @@ class DiscountCalculator extends Base
963
  $all_used_coupons = array_merge($all_used_coupons,$used_coupons_per_rule);
964
  }
965
  }
 
966
  $all_used_coupons = array_unique($all_used_coupons);
967
  return $all_used_coupons;
968
  }
79
  continue;
80
  }
81
  $rule_id = $rule->getId();
82
+ $hide_bulk_table = apply_filters('advanced_woo_discount_rules_hide_specific_rules_in_bulk_table', false, $rule_id, $rule, $product);
83
  if ($hide_bulk_table) {
84
  continue;
85
  }
738
  unset(self::$total_discounts[$matched_item_key]);
739
  self::$total_discounts[$matched_item_key] = $valid_discounts[$matched_item_key];
740
  }
741
+ $product_price = floatval($product_price);
742
  $discounted_price = $product_price - $discount_price;
743
  if ($discounted_price < 0 ) {
744
  $discounted_price = 0;
964
  $all_used_coupons = array_merge($all_used_coupons,$used_coupons_per_rule);
965
  }
966
  }
967
+ $all_used_coupons = array_merge($all_used_coupons, Helper::getAvailableCouponNameFromRules());
968
  $all_used_coupons = array_unique($all_used_coupons);
969
  return $all_used_coupons;
970
  }
v2/App/Controllers/ManageDiscount.php CHANGED
@@ -11,7 +11,7 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
11
 
12
  class ManageDiscount extends Base
13
  {
14
- public static $available_rules = array(), $calculator, $on_sale_products = array(), $calculated_cart_item_discount = array(), $calculated_cart_discount = array(), $calculated_product_discount = array(), $cart_discounts = array(), $set_total_quantity = 0, $categories_slug = array(), $cart_tot_qty = array();
15
  public $free_shipping = false, $shipping_obj;
16
 
17
  /**
@@ -160,6 +160,16 @@ class ManageDiscount extends Base
160
  return $value;
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * Modify the product's price when discount applicable.
165
  * @param $price_html
@@ -170,101 +180,111 @@ class ManageDiscount extends Base
170
  */
171
  function getPriceHtml($price_html, $product, $quantity = 1, $ajax_price = false)
172
  {
173
- if (empty(self::$available_rules)) {
174
- if($ajax_price){
175
- return false;
 
 
 
 
 
 
 
176
  }
177
- return $price_html;
178
- }
179
- $disable_strikeout_for_product_types = apply_filters('advanced_woo_discount_rules_disable_strikeout_for_product_types', array('grouped'), $product, $ajax_price);
180
- if (self::$woocommerce_helper->productTypeIs($product, $disable_strikeout_for_product_types)) {
181
- return $price_html;
182
- }
183
 
184
- // $initial_price_html = $price_html;
185
- $initial_price_html = $this->getCalculateDiscountPriceFrom($product, $price_html, $ajax_price);
186
 
187
- $modify_price = apply_filters('advanced_woo_discount_rules_modify_price_html', true, $price_html, $product, $quantity);
188
- if (!$modify_price) {
189
- if($ajax_price){
190
- return false;
191
- }
192
- return $price_html;
193
- }
194
- if (is_product() && empty(self::$config->getConfig('modify_price_at_product_page', 1))) {
195
- if($ajax_price){
196
- return false;
197
- }
198
- return $price_html;
199
- }
200
- if (is_shop() && empty(self::$config->getConfig('modify_price_at_shop_page', 1))) {
201
- if($ajax_price){
202
- return false;
203
- }
204
- return $price_html;
205
- }
206
- if (is_product_category() && empty(self::$config->getConfig('modify_price_at_category_page', 1))) {
207
- if($ajax_price){
208
- return false;
209
  }
210
- return $price_html;
211
- }
212
- if ($ajax_price) {
213
- $price_html = $initial_price_html;
214
- $quantity = $this->input->post('qty', '');
215
- if(!$price_html || empty($quantity)){
216
- return false;
217
  }
218
- }
219
 
220
- //Check the product object is from WC_Product Class
221
- if (is_a($product, 'WC_Product')) {
222
- if(!$ajax_price) {
223
- if (self::$woocommerce_helper->productTypeIs($product, array('variable'))) {
224
- return $price_html;
225
  }
 
226
  }
227
- $product_id = Woocommerce::getProductId($product);
228
- //Calculate the product price
229
- $prices = self::calculateInitialAndDiscountedPrice($product, $quantity, $is_cart = false, $ajax_price);
230
- $apply_as_cart_rule = isset($prices['apply_as_cart_rule']) ? $prices['apply_as_cart_rule'] : array('no');
231
- //echo "<pre>"; print_r($apply_as_cart_rule); echo "</pre>";
232
- if(!in_array('no', $apply_as_cart_rule)){
233
  return $price_html;
234
  }
235
- if($ajax_price){
236
- $discount_details = (isset($prices['total_discount_details'])) ? $prices['total_discount_details'] : false;
237
- if($discount_details) {
238
- // $initial_price = (isset($prices['initial_price_with_tax'])) ? $prices['initial_price_with_tax'] : 0;
239
- //$discounted_price = (isset($prices['discounted_price_with_tax'])) ? $prices['discounted_price_with_tax'] : 0;
240
- $initial_price = isset($prices['initial_price']) ? $prices['initial_price'] : 0;
241
- $discounted_price = isset($prices['discounted_price']) ? $prices['discounted_price'] : 0;
242
- if(empty($initial_price) || empty($discounted_price) || empty($discount_details)){
 
 
 
 
 
 
 
 
 
 
243
  return $price_html;
244
  }
245
- return $this->getSetDiscountItemPriceHtml($discount_details, $initial_price, $discounted_price, $product, $price_html = true, $quantity, $ajax_price);
246
- }else{
247
- return false;
248
  }
249
- }else {
250
- if (!$prices) {
 
 
 
 
251
  return $price_html;
252
  }
253
- self::$calculated_product_discount[$product_id] = $prices;
254
- $initial_price_with_tax_call = $discounted_price_with_tax_call = 0;
255
- $calculator = self::$calculator;
256
- $initial_price = isset($prices['initial_price']) ? $prices['initial_price'] : 0;
257
- $discounted_price = isset($prices['discounted_price']) ? $prices['discounted_price'] : 0;
258
- if(!empty($initial_price)){
259
- $initial_price_with_tax_call = $calculator->mayHaveTax($product, $initial_price);
260
- }
261
- if(!empty($discounted_price)){
262
- $discounted_price_with_tax_call = $calculator->mayHaveTax($product, $discounted_price);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  }
264
- $price_html = $this->getStrikeoutPrice($initial_price_with_tax_call, $discounted_price_with_tax_call, true, false, $initial_price_html);
265
- $price_html = $price_html.Woocommerce::getProductPriceSuffix($product, $discounted_price_with_tax_call, $prices);
266
- }
267
 
 
268
  }
269
 
270
  return $price_html;
@@ -370,79 +390,81 @@ class ManageDiscount extends Base
370
  */
371
  function getVariablePriceHtml($price_html, $product, $quantity = 1)
372
  {
373
- if (empty(self::$available_rules)) {
374
- return $price_html;
375
- }
376
- $modify_price = apply_filters('advanced_woo_discount_rules_modify_price_html', true, $price_html, $product, $quantity);
377
- if (!$modify_price) {
378
- return $price_html;
379
- }
 
380
 
381
- if (is_product() && empty(self::$config->getConfig('modify_price_at_product_page', 1))) {
382
- return $price_html;
383
- }
384
- if (is_shop() && empty(self::$config->getConfig('modify_price_at_shop_page', 1))) {
385
- return $price_html;
386
- }
387
- if (is_product_category() && empty(self::$config->getConfig('modify_price_at_category_page', 1))) {
388
- return $price_html;
389
- }
390
 
391
- $original_prices_list = $discount_prices_lists = array();
392
- $variations = Woocommerce::getProductChildren($product);
393
 
394
- if (!empty($variations)) {
395
- foreach ($variations as $variation_id) {
396
- if (empty($variation_id)) {
397
- continue;
398
- }
399
- $variation = Woocommerce::getProduct($variation_id);
400
- $prices = self::calculateInitialAndDiscountedPrice($variation, $quantity);
401
- if (!isset($prices['initial_price']) || !isset($prices['discounted_price'])) {
402
- return $this->removeDuplicateStrikeoutPrice($price_html);
 
 
 
403
  }
404
- $original_prices_list[] = $prices['initial_price'];
405
- $discount_prices_lists[] = $prices['discounted_price'];
406
  }
407
- }
408
- $discount_prices_lists = array_unique($discount_prices_lists);
409
- $original_prices_list = array_unique($original_prices_list);
410
- if(empty($discount_prices_lists)){
411
- return $price_html;
412
- }
413
- if(empty($original_prices_list)){
414
- return $price_html;
415
- }
416
- $min_price = min($discount_prices_lists);
417
- $max_price = max($discount_prices_lists);
418
- $min_original_price = min($original_prices_list);
419
- $max_original_price = max($original_prices_list);
420
- $calculator = self::$calculator;
421
- if(!empty($min_original_price)){
422
- $min_original_price = $calculator->mayHaveTax($product, $min_original_price);
423
- }
424
- if(!empty($max_original_price)){
425
- $max_original_price = $calculator->mayHaveTax($product, $max_original_price);
426
- }
427
- if(!empty($min_price)){
428
- $min_price = $calculator->mayHaveTax($product, $min_price);
429
- }
430
- if(!empty($max_price)){
431
- $max_price = $calculator->mayHaveTax($product, $max_price);
432
- }
433
- $price_range_suffix = self::$woocommerce_helper->getProductPriceSuffix($product);
434
- if ($min_original_price == $max_original_price) {
435
- $price_html = self::$woocommerce_helper->formatPrice($min_original_price) . $price_range_suffix;
436
- } elseif ($min_original_price < $max_original_price) {
437
- $price_html = self::$woocommerce_helper->formatPriceRange($min_original_price, $max_original_price) . $price_range_suffix;
438
- }
439
 
440
- if ($min_price == $max_price) {
441
- $price_html_discounted = self::$woocommerce_helper->formatPrice($min_price) . $price_range_suffix;
442
- return $this->getStrikeoutPrice($price_html, $price_html_discounted, false, true);
443
- } elseif ($min_price < $max_price) {
444
- $price_html_discounted = self::$woocommerce_helper->formatPriceRange($min_price, $max_price) . $price_range_suffix;
445
- return $this->getStrikeoutPrice($price_html, $price_html_discounted, false, true);
 
446
  }
447
 
448
  return $price_html;
@@ -617,57 +639,59 @@ class ManageDiscount extends Base
617
  function applyCartDiscount($cart)
618
  {
619
  $discount_apply_type = self::$config->getConfig('apply_cart_discount_as', 'fee');
620
- $combine_all_discounts = self::$config->getConfig('combine_all_cart_discounts', 0);
621
- $total_combined_discounts = 0;
622
- $apply_as_cart_fee_details = DiscountCalculator::$price_discount_apply_as_cart_discount;
623
- $flat_in_subtotal = array();
624
- if(!empty($apply_as_cart_fee_details)){
625
- foreach ($apply_as_cart_fee_details as $rule_id => $product_id){
626
- $discount_value = 0;
627
- foreach ($product_id as $detail) {
628
- if($detail['discount_type'] == 'wdr_cart_discount' && $detail['apply_type'] == 'flat_in_subtotal'){
629
- if(!isset($flat_in_subtotal[$rule_id])){
630
- $flat_in_subtotal[$rule_id]['value'] = $detail['discounted_price'];
631
- $flat_in_subtotal[$rule_id]['label'] = $detail['discount_label'];
 
 
 
 
 
632
  }
633
- }else{
634
- $discount_value += $detail['discounted_price'];
635
- $label = (isset($detail['discount_label']) && !empty($detail['discount_label'])) ? $detail['discount_label'] : $detail['rule_name'];
 
 
 
 
 
 
636
  }
637
  }
638
- if ($discount_value > 0) {
639
- if (empty($combine_all_discounts)) {
640
- $discount_value = -1 * $discount_value;
 
 
 
641
  Woocommerce::addCartFee($cart, apply_filters('advanced_woo_discount_rules_additional_fee_label', $label, $cart), apply_filters('advanced_woo_discount_rules_additional_fee_value', $discount_value, $cart));
642
  }else{
643
- $total_combined_discounts += $discount_value;
644
  }
645
- self::$calculated_cart_discount['discount'][] = array('price' => $discount_value, 'label' => $label);
646
- }
647
- }
648
- }
649
- if (!empty($flat_in_subtotal)) {
650
- foreach ($flat_in_subtotal as $discount){
651
- if(empty($combine_all_discounts)){
652
- $discount_value = -1 * $discount['value'];
653
- $label = $discount['label'];
654
- Woocommerce::addCartFee($cart, apply_filters('advanced_woo_discount_rules_additional_fee_label', $label, $cart), apply_filters('advanced_woo_discount_rules_additional_fee_value', $discount_value, $cart));
655
- }else{
656
- $total_combined_discounts += $discount['value'];
657
  }
658
  }
659
- }
660
 
661
- //Combine all discounts and add as single discounts
662
- if (!empty($total_combined_discounts) && !empty($combine_all_discounts)) {
663
- $label = self::$config->getConfig('discount_label_for_combined_discounts', __('cart discount', WDR_TEXT_DOMAIN));
664
- $label = Helper::getCleanHtml($label);
665
- if ($discount_apply_type == 'fee') {
666
- $total_combined_discounts = -1 * $total_combined_discounts;
667
- self::$woocommerce_helper->addCartFee($cart, apply_filters('advanced_woo_discount_rules_additional_fee_label', $label, $cart), apply_filters('advanced_woo_discount_rules_additional_fee_value', $total_combined_discounts, $cart));
 
668
  }
 
669
  }
670
- DiscountCalculator::$price_discount_apply_as_cart_discount = array();
671
  }
672
 
673
  /**
@@ -757,6 +781,258 @@ class ManageDiscount extends Base
757
  return $response;
758
  }
759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  /**
761
  * Has third party coupon
762
  *
@@ -1267,8 +1543,9 @@ class ManageDiscount extends Base
1267
  */
1268
  function showAppliedRulesMessages()
1269
  {
1270
- $message = self::$config->getConfig('applied_rule_message', 'Discount <strong>"{{title}}"</strong> has been applied to your cart.');
1271
  $message = Helper::getCleanHtml($message);
 
1272
  $calc = self::$calculator;
1273
  $applied_rules = $calc::$applied_rules;
1274
  if (!empty($applied_rules)) {
@@ -1375,7 +1652,8 @@ class ManageDiscount extends Base
1375
  function getYouSavedText($discount)
1376
  {
1377
  if (!empty($discount)) {
1378
- $text = self::$config->getConfig('you_saved_text');
 
1379
  $text = Helper::getCleanHtml($text);
1380
  $message = str_replace('{{total_discount}}', $discount, $text);
1381
  return '<div class="awdr-you-saved-text" style="color: green">' . $message . '</div>';
@@ -1802,7 +2080,7 @@ class ManageDiscount extends Base
1802
  "woocommerce_product_is_on_sale" => array("Wdr\App\Controllers\ManageDiscount|isProductInSale"),
1803
  "woocommerce_product_get_sale_price" => array(),
1804
  "woocommerce_product_get_regular_price" => array(),
1805
- "woocommerce_variable_price_html" => array(),
1806
  "woocommerce_cart_item_price" => array("Wdr\App\Controllers\ManageDiscount|getCartProductPriceHtml"),
1807
  "woocommerce_cart_item_subtotal" => array("Wdr\App\Controllers\ManageDiscount|getCartProductSubtotalPriceHtml"),
1808
  //Actions
@@ -2067,4 +2345,27 @@ class ManageDiscount extends Base
2067
  }
2068
  }
2069
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2070
  }
11
 
12
  class ManageDiscount extends Base
13
  {
14
+ public static $apply_as_coupon_values = array(), $available_rules = array(), $calculator, $on_sale_products = array(), $calculated_cart_item_discount = array(), $calculated_cart_discount = array(), $calculated_product_discount = array(), $cart_discounts = array(), $set_total_quantity = 0, $categories_slug = array(), $cart_tot_qty = array();
15
  public $free_shipping = false, $shipping_obj;
16
 
17
  /**
160
  return $value;
161
  }
162
 
163
+ function doProcessStrikeOut($price_html, $product, $quantity = 1, $ajax_price = false){
164
+ if(isset($_REQUEST['action'])){
165
+ $blocked_actions = array('inline-save');
166
+ if(in_array($_REQUEST['action'], $blocked_actions)){
167
+ return false;
168
+ }
169
+ }
170
+ return true;
171
+ }
172
+
173
  /**
174
  * Modify the product's price when discount applicable.
175
  * @param $price_html
180
  */
181
  function getPriceHtml($price_html, $product, $quantity = 1, $ajax_price = false)
182
  {
183
+ if($this->doProcessStrikeOut($price_html, $product, $quantity, $ajax_price)){
184
+ if (empty(self::$available_rules)) {
185
+ if($ajax_price){
186
+ return false;
187
+ }
188
+ return $price_html;
189
+ }
190
+ $disable_strikeout_for_product_types = apply_filters('advanced_woo_discount_rules_disable_strikeout_for_product_types', array('grouped'), $product, $ajax_price);
191
+ if (self::$woocommerce_helper->productTypeIs($product, $disable_strikeout_for_product_types)) {
192
+ return $price_html;
193
  }
 
 
 
 
 
 
194
 
195
+ // $initial_price_html = $price_html;
196
+ $initial_price_html = $this->getCalculateDiscountPriceFrom($product, $price_html, $ajax_price);
197
 
198
+ $modify_price = apply_filters('advanced_woo_discount_rules_modify_price_html', true, $price_html, $product, $quantity);
199
+ if (!$modify_price) {
200
+ if($ajax_price){
201
+ return false;
202
+ }
203
+ return $price_html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  }
205
+
206
+ if(empty(self::$config->getConfig('modify_price_at_product_page', 1)) && empty(self::$config->getConfig('modify_price_at_shop_page', 1)) && empty(self::$config->getConfig('modify_price_at_category_page', 1))){
207
+ if($ajax_price){
208
+ return false;
209
+ }
210
+ return $price_html;
 
211
  }
 
212
 
213
+ if (is_product() && empty(self::$config->getConfig('modify_price_at_product_page', 1))) {
214
+ if($ajax_price){
215
+ return false;
 
 
216
  }
217
+ return $price_html;
218
  }
219
+ if (is_shop() && empty(self::$config->getConfig('modify_price_at_shop_page', 1))) {
220
+ if($ajax_price){
221
+ return false;
222
+ }
 
 
223
  return $price_html;
224
  }
225
+ if (is_product_category() && empty(self::$config->getConfig('modify_price_at_category_page', 1))) {
226
+ if($ajax_price){
227
+ return false;
228
+ }
229
+ return $price_html;
230
+ }
231
+ if ($ajax_price) {
232
+ $price_html = $initial_price_html;
233
+ $quantity = $this->input->post('qty', '');
234
+ if(!$price_html || empty($quantity)){
235
+ return false;
236
+ }
237
+ }
238
+
239
+ //Check the product object is from WC_Product Class
240
+ if (is_a($product, 'WC_Product')) {
241
+ if(!$ajax_price) {
242
+ if (self::$woocommerce_helper->productTypeIs($product, array('variable'))) {
243
  return $price_html;
244
  }
 
 
 
245
  }
246
+ $product_id = Woocommerce::getProductId($product);
247
+ //Calculate the product price
248
+ $prices = self::calculateInitialAndDiscountedPrice($product, $quantity, $is_cart = false, $ajax_price);
249
+ $apply_as_cart_rule = isset($prices['apply_as_cart_rule']) ? $prices['apply_as_cart_rule'] : array('no');
250
+ //echo "<pre>"; print_r($apply_as_cart_rule); echo "</pre>";
251
+ if(!in_array('no', $apply_as_cart_rule)){
252
  return $price_html;
253
  }
254
+ if($ajax_price){
255
+ $discount_details = (isset($prices['total_discount_details'])) ? $prices['total_discount_details'] : false;
256
+ if($discount_details) {
257
+ // $initial_price = (isset($prices['initial_price_with_tax'])) ? $prices['initial_price_with_tax'] : 0;
258
+ //$discounted_price = (isset($prices['discounted_price_with_tax'])) ? $prices['discounted_price_with_tax'] : 0;
259
+ $initial_price = isset($prices['initial_price']) ? $prices['initial_price'] : 0;
260
+ $discounted_price = isset($prices['discounted_price']) ? $prices['discounted_price'] : 0;
261
+ if(empty($initial_price) || empty($discounted_price) || empty($discount_details)){
262
+ return $price_html;
263
+ }
264
+ return $this->getSetDiscountItemPriceHtml($discount_details, $initial_price, $discounted_price, $product, $price_html = true, $quantity, $ajax_price);
265
+ }else{
266
+ return false;
267
+ }
268
+ }else {
269
+ if (!$prices) {
270
+ return $price_html;
271
+ }
272
+ self::$calculated_product_discount[$product_id] = $prices;
273
+ $initial_price_with_tax_call = $discounted_price_with_tax_call = 0;
274
+ $calculator = self::$calculator;
275
+ $initial_price = isset($prices['initial_price']) ? $prices['initial_price'] : 0;
276
+ $discounted_price = isset($prices['discounted_price']) ? $prices['discounted_price'] : 0;
277
+ if(!empty($initial_price)){
278
+ $initial_price_with_tax_call = $calculator->mayHaveTax($product, $initial_price);
279
+ }
280
+ if(!empty($discounted_price)){
281
+ $discounted_price_with_tax_call = $calculator->mayHaveTax($product, $discounted_price);
282
+ }
283
+ $price_html = $this->getStrikeoutPrice($initial_price_with_tax_call, $discounted_price_with_tax_call, true, false, $initial_price_html);
284
+ $price_html = $price_html.Woocommerce::getProductPriceSuffix($product, $discounted_price_with_tax_call, $prices);
285
  }
 
 
 
286
 
287
+ }
288
  }
289
 
290
  return $price_html;
390
  */
391
  function getVariablePriceHtml($price_html, $product, $quantity = 1)
392
  {
393
+ if($this->doProcessStrikeOut($price_html, $product, $quantity)){
394
+ if (empty(self::$available_rules)) {
395
+ return $price_html;
396
+ }
397
+ $modify_price = apply_filters('advanced_woo_discount_rules_modify_price_html', true, $price_html, $product, $quantity);
398
+ if (!$modify_price) {
399
+ return $price_html;
400
+ }
401
 
402
+ if (is_product() && empty(self::$config->getConfig('modify_price_at_product_page', 1))) {
403
+ return $price_html;
404
+ }
405
+ if (is_shop() && empty(self::$config->getConfig('modify_price_at_shop_page', 1))) {
406
+ return $price_html;
407
+ }
408
+ if (is_product_category() && empty(self::$config->getConfig('modify_price_at_category_page', 1))) {
409
+ return $price_html;
410
+ }
411
 
412
+ $original_prices_list = $discount_prices_lists = array();
413
+ $variations = Woocommerce::getProductChildren($product);
414
 
415
+ if (!empty($variations)) {
416
+ foreach ($variations as $variation_id) {
417
+ if (empty($variation_id)) {
418
+ continue;
419
+ }
420
+ $variation = Woocommerce::getProduct($variation_id);
421
+ $prices = self::calculateInitialAndDiscountedPrice($variation, $quantity);
422
+ if (!isset($prices['initial_price']) || !isset($prices['discounted_price'])) {
423
+ return $this->removeDuplicateStrikeoutPrice($price_html);
424
+ }
425
+ $original_prices_list[] = $prices['initial_price'];
426
+ $discount_prices_lists[] = $prices['discounted_price'];
427
  }
 
 
428
  }
429
+ $discount_prices_lists = array_unique($discount_prices_lists);
430
+ $original_prices_list = array_unique($original_prices_list);
431
+ if(empty($discount_prices_lists)){
432
+ return $price_html;
433
+ }
434
+ if(empty($original_prices_list)){
435
+ return $price_html;
436
+ }
437
+ $min_price = min($discount_prices_lists);
438
+ $max_price = max($discount_prices_lists);
439
+ $min_original_price = min($original_prices_list);
440
+ $max_original_price = max($original_prices_list);
441
+ $calculator = self::$calculator;
442
+ if(!empty($min_original_price)){
443
+ $min_original_price = $calculator->mayHaveTax($product, $min_original_price);
444
+ }
445
+ if(!empty($max_original_price)){
446
+ $max_original_price = $calculator->mayHaveTax($product, $max_original_price);
447
+ }
448
+ if(!empty($min_price)){
449
+ $min_price = $calculator->mayHaveTax($product, $min_price);
450
+ }
451
+ if(!empty($max_price)){
452
+ $max_price = $calculator->mayHaveTax($product, $max_price);
453
+ }
454
+ $price_range_suffix = self::$woocommerce_helper->getProductPriceSuffix($product);
455
+ if ($min_original_price == $max_original_price) {
456
+ $price_html = self::$woocommerce_helper->formatPrice($min_original_price) . $price_range_suffix;
457
+ } elseif ($min_original_price < $max_original_price) {
458
+ $price_html = self::$woocommerce_helper->formatPriceRange($min_original_price, $max_original_price) . $price_range_suffix;
459
+ }
 
460
 
461
+ if ($min_price == $max_price) {
462
+ $price_html_discounted = self::$woocommerce_helper->formatPrice($min_price) . $price_range_suffix;
463
+ return $this->getStrikeoutPrice($price_html, $price_html_discounted, false, true);
464
+ } elseif ($min_price < $max_price) {
465
+ $price_html_discounted = self::$woocommerce_helper->formatPriceRange($min_price, $max_price) . $price_range_suffix;
466
+ return $this->getStrikeoutPrice($price_html, $price_html_discounted, false, true);
467
+ }
468
  }
469
 
470
  return $price_html;
639
  function applyCartDiscount($cart)
640
  {
641
  $discount_apply_type = self::$config->getConfig('apply_cart_discount_as', 'fee');
642
+ if($discount_apply_type == "fee"){
643
+ $combine_all_discounts = self::$config->getConfig('combine_all_cart_discounts', 0);
644
+ $total_combined_discounts = 0;
645
+ $apply_as_cart_fee_details = DiscountCalculator::$price_discount_apply_as_cart_discount;
646
+ $flat_in_subtotal = array();
647
+ if(!empty($apply_as_cart_fee_details)){
648
+ foreach ($apply_as_cart_fee_details as $rule_id => $product_id){
649
+ $discount_value = 0;
650
+ foreach ($product_id as $detail) {
651
+ if($detail['discount_type'] == 'wdr_cart_discount' && $detail['apply_type'] == 'flat_in_subtotal'){
652
+ if(!isset($flat_in_subtotal[$rule_id])){
653
+ $flat_in_subtotal[$rule_id]['value'] = $detail['discounted_price'];
654
+ $flat_in_subtotal[$rule_id]['label'] = $detail['discount_label'];
655
+ }
656
+ }else{
657
+ $discount_value += $detail['discounted_price'];
658
+ $label = (isset($detail['discount_label']) && !empty($detail['discount_label'])) ? $detail['discount_label'] : $detail['rule_name'];
659
  }
660
+ }
661
+ if ($discount_value > 0) {
662
+ if (empty($combine_all_discounts)) {
663
+ $discount_value = -1 * $discount_value;
664
+ Woocommerce::addCartFee($cart, apply_filters('advanced_woo_discount_rules_additional_fee_label', $label, $cart), apply_filters('advanced_woo_discount_rules_additional_fee_value', $discount_value, $cart));
665
+ }else{
666
+ $total_combined_discounts += $discount_value;
667
+ }
668
+ self::$calculated_cart_discount['discount'][] = array('price' => $discount_value, 'label' => $label);
669
  }
670
  }
671
+ }
672
+ if (!empty($flat_in_subtotal)) {
673
+ foreach ($flat_in_subtotal as $discount){
674
+ if(empty($combine_all_discounts)){
675
+ $discount_value = -1 * $discount['value'];
676
+ $label = $discount['label'];
677
  Woocommerce::addCartFee($cart, apply_filters('advanced_woo_discount_rules_additional_fee_label', $label, $cart), apply_filters('advanced_woo_discount_rules_additional_fee_value', $discount_value, $cart));
678
  }else{
679
+ $total_combined_discounts += $discount['value'];
680
  }
 
 
 
 
 
 
 
 
 
 
 
 
681
  }
682
  }
 
683
 
684
+ //Combine all discounts and add as single discounts
685
+ if (!empty($total_combined_discounts) && !empty($combine_all_discounts)) {
686
+ $label = self::$config->getConfig('discount_label_for_combined_discounts', __('Cart discount', WDR_TEXT_DOMAIN));
687
+ $label = Helper::getCleanHtml($label);
688
+ if ($discount_apply_type == 'fee') {
689
+ $total_combined_discounts = -1 * $total_combined_discounts;
690
+ self::$woocommerce_helper->addCartFee($cart, apply_filters('advanced_woo_discount_rules_additional_fee_label', $label, $cart), apply_filters('advanced_woo_discount_rules_additional_fee_value', $total_combined_discounts, $cart));
691
+ }
692
  }
693
+ DiscountCalculator::$price_discount_apply_as_cart_discount = array();
694
  }
 
695
  }
696
 
697
  /**
781
  return $response;
782
  }
783
 
784
+ /**
785
+ * To change the discount name/code in front end
786
+ * */
787
+ public function changeCouponLabelInFrontEnd($text, $coupon)
788
+ {
789
+ if(!empty(self::$apply_as_coupon_values)){
790
+ $coupon_code = Woocommerce::getCouponCode($coupon);
791
+ $coupon_codes = array_keys(self::$apply_as_coupon_values);
792
+ if(in_array($coupon_code, $coupon_codes)){
793
+ $text = self::$apply_as_coupon_values[$coupon_code]['display_text'];
794
+ }
795
+ }
796
+
797
+ return $text;
798
+ }
799
+
800
+ /**
801
+ * Set coupon values
802
+ * */
803
+ public static function setCartCouponValues($label, $discount_value, $cart_item_keys){
804
+ $coupon_code = apply_filters('woocommerce_coupon_code', $label);
805
+ self::$apply_as_coupon_values[$coupon_code]['value'] = $discount_value;
806
+ self::$apply_as_coupon_values[$coupon_code]['cart_item_keys'] = $cart_item_keys;
807
+ self::$apply_as_coupon_values[$coupon_code]['display_text'] = $label;
808
+ }
809
+
810
+ /**
811
+ * Remove duplicate values from multi dimension array
812
+ * */
813
+ protected static function removeDuplicateValues($apply_as_cart_fee_details){
814
+ if(!empty($apply_as_cart_fee_details)){
815
+ foreach ($apply_as_cart_fee_details as $key => $apply_as_cart_fee_detail){
816
+ $apply_as_cart_fee_details[$key] = array_map("unserialize", array_unique(array_map("serialize", $apply_as_cart_fee_detail)));
817
+ }
818
+ }
819
+ return $apply_as_cart_fee_details;
820
+
821
+ }
822
+
823
+ /**
824
+ * Apply dynamic coupon for cart rules
825
+ * */
826
+ function applyVirtualCouponForCartRules(){
827
+ $discount_apply_type = self::$config->getConfig('apply_cart_discount_as', 'fee');
828
+ if($discount_apply_type == "coupon"){
829
+ remove_action('woocommerce_after_calculate_totals', array($this, 'applyVirtualCouponForCartRules'), 10);
830
+ $combine_all_discounts = self::$config->getConfig('combine_all_cart_discounts', 0);
831
+ $total_combined_discounts = 0;
832
+ $combined_discounts_cart_items = array();
833
+ DiscountCalculator::$price_discount_apply_as_cart_discount = array();
834
+ if(function_exists('WC')){
835
+ $this->applyCartProductDiscount(WC()->cart);
836
+ }
837
+ $apply_as_cart_fee_details = DiscountCalculator::$price_discount_apply_as_cart_discount;
838
+ $apply_as_cart_fee_details = self::removeDuplicateValues($apply_as_cart_fee_details);
839
+ $flat_in_subtotal = array();
840
+ if(!empty($apply_as_cart_fee_details)){
841
+ foreach ($apply_as_cart_fee_details as $rule_id => $product_id){
842
+ $cart_item_keys = array();
843
+ $discount_value = 0;
844
+ foreach ($product_id as $detail) {
845
+ if($detail['discount_type'] == 'wdr_cart_discount' && $detail['apply_type'] == 'flat_in_subtotal'){
846
+ if(!isset($flat_in_subtotal[$rule_id])){
847
+ $flat_in_subtotal[$rule_id]['value'] = $detail['discounted_price'];
848
+ $flat_in_subtotal[$rule_id]['label'] = $detail['discount_label'];
849
+ $flat_in_subtotal[$rule_id]['cart_item_keys'][] = $detail['cart_item_key'];
850
+ }
851
+ }else{
852
+ $discount_value += $detail['discounted_price'];
853
+ $label = (isset($detail['discount_label']) && !empty($detail['discount_label'])) ? $detail['discount_label'] : $detail['rule_name'];
854
+ $cart_item_keys[] = $detail['cart_item_key'];
855
+ }
856
+ }
857
+ if ($discount_value > 0) {
858
+ if (empty($combine_all_discounts)) {
859
+ $discount_value = $discount_value;
860
+ self::setCartCouponValues($label, $discount_value, $cart_item_keys);
861
+ $this->applyFakeCouponsForCartRules($label);
862
+ }else{
863
+ $total_combined_discounts += $discount_value;
864
+ $combined_discounts_cart_items = array_merge($combined_discounts_cart_items, $cart_item_keys);
865
+ }
866
+ self::$calculated_cart_discount['discount'][] = array('price' => $discount_value, 'label' => $label, 'cart_item_keys' => $cart_item_keys);
867
+ }
868
+ }
869
+ }
870
+ if (!empty($flat_in_subtotal)) {
871
+ foreach ($flat_in_subtotal as $discount){
872
+ if(empty($combine_all_discounts)){
873
+ $discount_value = $discount['value'];
874
+ $label = $discount['label'];
875
+ self::setCartCouponValues($label, $discount_value, $discount['cart_item_keys']);
876
+ $this->applyFakeCouponsForCartRules($label);
877
+ }else{
878
+ $total_combined_discounts += $discount['value'];
879
+ $combined_discounts_cart_items = array_merge($combined_discounts_cart_items, $discount['cart_item_key']);
880
+ }
881
+ }
882
+ }
883
+
884
+ //Combine all discounts and add as single discounts
885
+ if (!empty($total_combined_discounts) && !empty($combine_all_discounts)) {
886
+ $label = self::$config->getConfig('discount_label_for_combined_discounts', __('Cart discount', WDR_TEXT_DOMAIN));
887
+ $label = Helper::getCleanHtml($label);
888
+ self::setCartCouponValues($label, $discount_value, $combined_discounts_cart_items);
889
+ $this->applyFakeCouponsForCartRules($label);
890
+ }
891
+ add_action('woocommerce_after_calculate_totals', array($this, 'applyVirtualCouponForCartRules'), 10);
892
+ }
893
+ }
894
+
895
+ /**
896
+ * Apply dynamic coupon for cart rules
897
+ * */
898
+ function applyFakeCouponsForCartRules($coupon_code){
899
+ global $woocommerce;
900
+ $coupon_code = apply_filters('woocommerce_coupon_code', $coupon_code);
901
+
902
+ // Validating the Coupon as Valid and discount status.
903
+ if(isset($woocommerce->cart)){
904
+ if(method_exists($woocommerce->cart, 'has_discount')){
905
+ if (!$woocommerce->cart->has_discount($coupon_code)) {
906
+ // Do not apply coupon with individual use coupon already applied
907
+ if ($woocommerce->cart->applied_coupons) {
908
+ foreach ($woocommerce->cart->applied_coupons as $code) {
909
+ $coupon = new \WC_Coupon($coupon_code);
910
+ if ($coupon->get_individual_use() == true) {
911
+ return false;
912
+ }
913
+ }
914
+ }
915
+
916
+ // Add coupon
917
+ $woocommerce->cart->applied_coupons[] = $coupon_code;
918
+ do_action('woocommerce_applied_coupon', $coupon_code);
919
+
920
+ return true;
921
+ }
922
+ }
923
+ }
924
+ }
925
+
926
+ /**
927
+ * Get product ids from cart key
928
+ * */
929
+ protected static function getProductIdsFromCartKey($cart_item_keys){
930
+ $product_ids = array();
931
+ $cart = Woocommerce::getCart();
932
+ foreach ($cart as $cart_item){
933
+ if(in_array($cart_item['key'], $cart_item_keys)){
934
+ $product_ids[] = $cart_item['product_id'];
935
+ }
936
+ }
937
+ if(!empty($product_ids)) $product_ids = array_unique($product_ids);
938
+ return $product_ids;
939
+ }
940
+
941
+ /**
942
+ * Get percentage amount from selected cart item
943
+ * */
944
+ protected static function getPercentageFromCartKey($product_ids, $discountPrice){
945
+ $total_price = 0;
946
+ $cart = Woocommerce::getCart();
947
+ foreach ($cart as $cart_item){
948
+ if(in_array($cart_item['product_id'], $product_ids)){
949
+ $total_price += $cart_item['quantity']*$cart_item['data']->get_price();
950
+ }
951
+ }
952
+ if($total_price > 0){
953
+ return ($discountPrice*100)/$total_price;
954
+ }
955
+ return $total_price;
956
+ }
957
+
958
+ /**
959
+ * Apply the custom coupon for create coupon condition
960
+ * @param $response
961
+ * @param $coupon_code
962
+ * @return array
963
+ */
964
+ function validateVirtualCouponForCartRules($response, $coupon_data)
965
+ {
966
+ $discount_apply_type = self::$config->getConfig('apply_cart_discount_as', 'fee');
967
+ if($discount_apply_type == "coupon"){
968
+ if(empty(self::$apply_as_coupon_values)){
969
+ remove_filter('woocommerce_get_shop_coupon_data', array($this, 'validateVirtualCouponForCartRules'), 10);
970
+ $this->applyVirtualCouponForCartRules();
971
+ add_filter('woocommerce_get_shop_coupon_data', array($this, 'validateVirtualCouponForCartRules'), 10, 2);
972
+ }
973
+
974
+ if(!empty(self::$apply_as_coupon_values)){
975
+ if(array_key_exists($coupon_data, self::$apply_as_coupon_values)){
976
+ $coupon_code = $coupon_data;
977
+ $amount = self::$apply_as_coupon_values[$coupon_code]['value'];
978
+ $cart_item_keys = self::$apply_as_coupon_values[$coupon_code]['cart_item_keys'];
979
+ $product_ids = self::getProductIdsFromCartKey($cart_item_keys);
980
+ $discount_in_percentage = self::getPercentageFromCartKey($product_ids, $amount);
981
+ } else {
982
+ return $response;
983
+ }
984
+ } else {
985
+ add_filter('woocommerce_coupon_error', '\Wdr\App\Helpers\Helper::removeErrorMessageForOurCoupons', 10, 3);
986
+ return $response;
987
+ }
988
+
989
+ // Getting Coupon Remove status from Session.
990
+ if(isset(WC()->session) && is_object(WC()->session) && method_exists(WC()->session, 'get')) {
991
+ $is_removed = WC()->session->get('woo_coupon_removed', '');
992
+ // If Both are same, then it won't added.
993
+ if(!empty($is_removed)){
994
+ if ($coupon_code == $is_removed) return $response;
995
+ }
996
+ }
997
+
998
+ if ($coupon_data == $coupon_code || wc_strtolower($coupon_data) == wc_strtolower($coupon_code)) {
999
+
1000
+ //if ($this->postData->get('remove_coupon', false) == $coupon_code) return false;
1001
+ if(empty($product_ids)){
1002
+ $discount_type = 'fixed_cart';
1003
+ } else {
1004
+ $discount_type = 'percent';
1005
+ $amount = $discount_in_percentage;
1006
+ }
1007
+
1008
+ $coupon = array(
1009
+ 'id' => time().rand(2, 9),
1010
+ 'amount' => $amount,
1011
+ 'individual_use' => false,
1012
+ 'product_ids' => $product_ids,
1013
+ 'exclude_product_ids' => array(),
1014
+ 'usage_limit' => '',
1015
+ 'usage_limit_per_user' => '',
1016
+ 'limit_usage_to_x_items' => '',
1017
+ 'usage_count' => '',
1018
+ 'expiry_date' => '',
1019
+ 'apply_before_tax' => 'yes',
1020
+ 'free_shipping' => false,
1021
+ 'product_categories' => array(),
1022
+ 'exclude_product_categories' => array(),
1023
+ 'exclude_sale_items' => false,
1024
+ 'minimum_amount' => '',
1025
+ 'maximum_amount' => '',
1026
+ 'customer_email' => '',
1027
+ );
1028
+ $coupon['discount_type'] = $discount_type;
1029
+ return $coupon;
1030
+ }
1031
+ }
1032
+
1033
+ return $response;
1034
+ }
1035
+
1036
  /**
1037
  * Has third party coupon
1038
  *
1543
  */
1544
  function showAppliedRulesMessages()
1545
  {
1546
+ $message = self::$config->getConfig('applied_rule_message', __('Discount <strong>{{title}}</strong> has been applied to your cart.', WDR_TEXT_DOMAIN));
1547
  $message = Helper::getCleanHtml($message);
1548
+ $message = __($message, WDR_TEXT_DOMAIN);
1549
  $calc = self::$calculator;
1550
  $applied_rules = $calc::$applied_rules;
1551
  if (!empty($applied_rules)) {
1652
  function getYouSavedText($discount)
1653
  {
1654
  if (!empty($discount)) {
1655
+ $text = self::$config->getConfig('you_saved_text', __("You saved {{total_discount}}", WDR_TEXT_DOMAIN));
1656
+ $text = __($text, WDR_TEXT_DOMAIN);
1657
  $text = Helper::getCleanHtml($text);
1658
  $message = str_replace('{{total_discount}}', $discount, $text);
1659
  return '<div class="awdr-you-saved-text" style="color: green">' . $message . '</div>';
2080
  "woocommerce_product_is_on_sale" => array("Wdr\App\Controllers\ManageDiscount|isProductInSale"),
2081
  "woocommerce_product_get_sale_price" => array(),
2082
  "woocommerce_product_get_regular_price" => array(),
2083
+ "woocommerce_variable_price_html" => array("Wdr\App\Controllers\ManageDiscount|getVariablePriceHtml"),
2084
  "woocommerce_cart_item_price" => array("Wdr\App\Controllers\ManageDiscount|getCartProductPriceHtml"),
2085
  "woocommerce_cart_item_subtotal" => array("Wdr\App\Controllers\ManageDiscount|getCartProductSubtotalPriceHtml"),
2086
  //Actions
2345
  }
2346
  }
2347
  }
2348
+
2349
+ /**
2350
+ * Display total savings in order
2351
+ * @param $order
2352
+ */
2353
+ public function displayTotalSavingsThroughDiscountInOrder($order){
2354
+ if (!is_object($order)) {
2355
+ if (!empty($order) && is_int($order)) {
2356
+ $order = self::$woocommerce_helper->getOrder($order);
2357
+ }
2358
+ }
2359
+ $items = $order->get_items();
2360
+ $total_discount = $this->getItemTotalDiscount($items);
2361
+
2362
+ $save_text = NULL;
2363
+
2364
+ if (!empty($total_discount)) {
2365
+ $total_discounted_price = self::$woocommerce_helper->formatPrice($total_discount, array('currency' => self::$woocommerce_helper->getOrderCurrency($order)));
2366
+ $subtotal_additional_text = $this->getYouSavedText($total_discounted_price);
2367
+ $save_text = apply_filters('advanced_woo_discount_rules_order_saved_text', $subtotal_additional_text, $total_discounted_price, $total_discount);
2368
+ }
2369
+ echo $save_text;
2370
+ }
2371
  }
v2/App/Helpers/Helper.php CHANGED
@@ -1,9 +1,13 @@
1
  <?php
2
 
3
  namespace Wdr\App\Helpers;
 
 
 
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
5
  class Helper
6
  {
 
7
  /**
8
  * Combine two array with unique values
9
  *
@@ -214,6 +218,79 @@ class Helper
214
  ', WDR_TEXT_DOMAIN);
215
  }
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  public static function create_nonce($action = -1)
218
  {
219
  return wp_create_nonce($action);
@@ -251,9 +328,9 @@ class Helper
251
 
252
  public static function displayCompatibleCheckMessages()
253
  {
254
- if (version_compare(WDR_VERSION, '2.2.1', '>=')) {
255
  if (defined('WDR_PRO_VERSION')) {
256
- if (version_compare(WDR_PRO_VERSION, '2.2.1', '<')) {
257
  $url = admin_url() . "plugins.php";
258
  $plugin_page = '<a target="_blank" href="' . $url . '">' . __('Update now', WDR_TEXT_DOMAIN) . '</a>';
259
  ?>
1
  <?php
2
 
3
  namespace Wdr\App\Helpers;
4
+ use Wdr\App\Controllers\Configuration;
5
+ use Wdr\App\Controllers\ManageDiscount;
6
+
7
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
8
  class Helper
9
  {
10
+ public static $available_coupon_names = null;
11
  /**
12
  * Combine two array with unique values
13
  *
218
  ', WDR_TEXT_DOMAIN);
219
  }
220
 
221
+ /**
222
+ * Get available coupon names
223
+ * */
224
+ public static function getAvailableCouponNameFromRules(){
225
+ if(self::$available_coupon_names === null){
226
+ $available_rules = ManageDiscount::$available_rules;
227
+ $coupon_names = array();
228
+ if(!empty($available_rules)){
229
+ foreach ($available_rules as $available_rule){
230
+ $discount_type = $available_rule->getRuleDiscountType();
231
+ if($discount_type == 'wdr_bulk_discount'){
232
+ $adjustment = $available_rule->getBulkAdjustments();
233
+ if(isset($adjustment->apply_as_cart_rule) && $adjustment->apply_as_cart_rule == 1){
234
+ if(!empty($adjustment->cart_label)){
235
+ $coupon_names[] = $adjustment->cart_label;
236
+ } else {
237
+ $coupon_names[] = $available_rule->getTitle();
238
+ }
239
+ }
240
+ } else if($discount_type == 'wdr_simple_discount'){
241
+ $adjustment = $available_rule->getProductAdjustments();
242
+ if(isset($adjustment->apply_as_cart_rule) && $adjustment->apply_as_cart_rule == 1){
243
+ if(!empty($adjustment->cart_label)){
244
+ $coupon_names[] = $adjustment->cart_label;
245
+ } else {
246
+ $coupon_names[] = $available_rule->getTitle();
247
+ }
248
+ }
249
+ } else if($discount_type == 'wdr_cart_discount'){
250
+ $adjustment = $available_rule->getCartAdjustments();
251
+ if(!empty($adjustment->label)){
252
+ $coupon_names[] = $adjustment->label;
253
+ } else {
254
+ $coupon_names[] = $available_rule->getTitle();
255
+ }
256
+ } else if($discount_type == 'wdr_set_discount'){
257
+ $adjustment = json_decode($available_rule->rule->set_adjustments);
258
+ if(isset($adjustment->apply_as_cart_rule) && $adjustment->apply_as_cart_rule == 1){
259
+ if(!empty($adjustment->cart_label)){
260
+ $coupon_names[] = $adjustment->cart_label;
261
+ } else {
262
+ $coupon_names[] = $available_rule->getTitle();
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+ $coupon_names[] = Configuration::getInstance()->getConfig('discount_label_for_combined_discounts', __('Cart discount', WDR_TEXT_DOMAIN));
269
+ foreach ($coupon_names as $key => $coupon_name){
270
+ $coupon_names[$key] = apply_filters('woocommerce_coupon_code', $coupon_name);
271
+ }
272
+ self::$available_coupon_names = $coupon_names;
273
+ }
274
+
275
+ return self::$available_coupon_names;
276
+ }
277
+
278
+ /**
279
+ * Remove error message for our coupons as sometime the coupon doesn't validate because of event calls before calculate totals
280
+ * */
281
+ public static function removeErrorMessageForOurCoupons($err, $err_code, $coupon){
282
+ if($err_code == 101){
283
+ if(!empty($coupon)){
284
+ $coupon_code = Woocommerce::getCouponCode($coupon);
285
+ if(in_array($coupon_code, self::getAvailableCouponNameFromRules())){
286
+ $err = '';
287
+ }
288
+ }
289
+ }
290
+
291
+ return $err;
292
+ }
293
+
294
  public static function create_nonce($action = -1)
295
  {
296
  return wp_create_nonce($action);
328
 
329
  public static function displayCompatibleCheckMessages()
330
  {
331
+ if (version_compare(WDR_VERSION, '2.2.2', '>=')) {
332
  if (defined('WDR_PRO_VERSION')) {
333
+ if (version_compare(WDR_PRO_VERSION, '2.2.2', '<')) {
334
  $url = admin_url() . "plugins.php";
335
  $plugin_page = '<a target="_blank" href="' . $url . '">' . __('Update now', WDR_TEXT_DOMAIN) . '</a>';
336
  ?>
v2/App/Helpers/Rule.php CHANGED
@@ -401,14 +401,18 @@ class Rule
401
  $user_role_passed = true;
402
  if (!empty($options) && isset($this->available_conditions[$condition_type]['object'])) {
403
  $this->available_conditions[$condition_type]['object']->rule = $this;
404
- $filter_passed_user_role = $this->available_conditions[$condition_type]['object']->check($cart, $options);
 
 
405
  }
406
  }
407
  if( !empty($condition_type) && $condition_type == 'user_list'){
408
  $user_list_passed = true;
409
  if (!empty($options) && isset($this->available_conditions[$condition_type]['object'])) {
410
  $this->available_conditions[$condition_type]['object']->rule = $this;
411
- $filter_passed_user_list = $this->available_conditions[$condition_type]['object']->check($cart, $options);
 
 
412
  }
413
  }
414
  if( !empty($condition_type) && !in_array($condition_type, array('user_role', 'user_list'))){
401
  $user_role_passed = true;
402
  if (!empty($options) && isset($this->available_conditions[$condition_type]['object'])) {
403
  $this->available_conditions[$condition_type]['object']->rule = $this;
404
+ if(method_exists($this->available_conditions[$condition_type]['object'], 'check')){
405
+ $filter_passed_user_role = $this->available_conditions[$condition_type]['object']->check($cart, $options);
406
+ }
407
  }
408
  }
409
  if( !empty($condition_type) && $condition_type == 'user_list'){
410
  $user_list_passed = true;
411
  if (!empty($options) && isset($this->available_conditions[$condition_type]['object'])) {
412
  $this->available_conditions[$condition_type]['object']->rule = $this;
413
+ if(method_exists($this->available_conditions[$condition_type]['object'], 'check')){
414
+ $filter_passed_user_list = $this->available_conditions[$condition_type]['object']->check($cart, $options);
415
+ }
416
  }
417
  }
418
  if( !empty($condition_type) && !in_array($condition_type, array('user_role', 'user_list'))){
v2/App/Helpers/Validation.php CHANGED
@@ -364,6 +364,7 @@ class Validation
364
  'position_to_show_discount_bar',
365
  'show_strikeout_when',
366
  'display_saving_text',
 
367
  )
368
  );
369
  //validate integer 0,1,2..
364
  'position_to_show_discount_bar',
365
  'show_strikeout_when',
366
  'display_saving_text',
367
+ 'apply_cart_discount_as',
368
  )
369
  );
370
  //validate integer 0,1,2..
v2/App/Router.php CHANGED
@@ -76,6 +76,7 @@ class Router
76
  if (in_array($display_saving_text, array('after_total', 'both_line_item_and_after_total'))) {
77
  add_filter('woocommerce_cart_totals_order_total_html', array(self::$manage_discount, 'getCartTotalPriceHtml'), 10, 1);
78
  add_action('woocommerce_get_formatted_order_total', array(self::$manage_discount, 'displayTotalSavingsInOrderAfterOrderTotal'), 10,2);
 
79
  }
80
  }
81
  add_filter('advanced_woo_discount_rules_get_order_line_item_you_saved_text', array(self::$manage_discount, 'orderSubTotalDiscountDetails'), 10, 3);
@@ -146,6 +147,11 @@ class Router
146
  add_filter('woocommerce_cart_totals_coupon_label', array(self::$manage_discount, 'overwriteCouponLabel'), 10, 2);
147
  add_action('woocommerce_cart_calculate_fees', array(self::$manage_discount, 'applyCartDiscount'));
148
  add_filter('woocommerce_get_shop_coupon_data', array(self::$manage_discount, 'checkCouponToApply'), 10, 2);
 
 
 
 
 
149
  add_filter('woocommerce_cart_totals_coupon_html', array(self::$manage_discount, 'hideZeroCouponValue'), 10, 2);
150
  $show_rule_message = $manage_discount_class::$config->getConfig('show_applied_rules_message_on_cart', 0);
151
  if (!empty($show_rule_message)) {
76
  if (in_array($display_saving_text, array('after_total', 'both_line_item_and_after_total'))) {
77
  add_filter('woocommerce_cart_totals_order_total_html', array(self::$manage_discount, 'getCartTotalPriceHtml'), 10, 1);
78
  add_action('woocommerce_get_formatted_order_total', array(self::$manage_discount, 'displayTotalSavingsInOrderAfterOrderTotal'), 10,2);
79
+ add_action( 'woocommerce_admin_order_totals_after_total', array( self::$manage_discount, 'displayTotalSavingsThroughDiscountInOrder'), 10);
80
  }
81
  }
82
  add_filter('advanced_woo_discount_rules_get_order_line_item_you_saved_text', array(self::$manage_discount, 'orderSubTotalDiscountDetails'), 10, 3);
147
  add_filter('woocommerce_cart_totals_coupon_label', array(self::$manage_discount, 'overwriteCouponLabel'), 10, 2);
148
  add_action('woocommerce_cart_calculate_fees', array(self::$manage_discount, 'applyCartDiscount'));
149
  add_filter('woocommerce_get_shop_coupon_data', array(self::$manage_discount, 'checkCouponToApply'), 10, 2);
150
+
151
+ add_action('woocommerce_after_calculate_totals', array(self::$manage_discount, 'applyVirtualCouponForCartRules'), 10);
152
+ add_filter('woocommerce_get_shop_coupon_data', array(self::$manage_discount, 'validateVirtualCouponForCartRules'), 10, 2);
153
+ add_filter('woocommerce_cart_totals_coupon_label', array(self::$manage_discount, 'changeCouponLabelInFrontEnd'), 10, 2);
154
+
155
  add_filter('woocommerce_cart_totals_coupon_html', array(self::$manage_discount, 'hideZeroCouponValue'), 10, 2);
156
  $show_rule_message = $manage_discount_class::$config->getConfig('show_applied_rules_message_on_cart', 0);
157
  if (!empty($show_rule_message)) {
v2/App/Views/Admin/Rules/Conditions/Main.php CHANGED
@@ -35,6 +35,7 @@ if (!defined('ABSPATH')) {
35
  $render_saved_condition = false;
36
  foreach ($conditions as $condition) {
37
  $type = isset($condition->type) ? $condition->type : NULL;
 
38
  if($awdr_discount_type != 'wdr_free_shipping' && $type == 'cart_item_product_onsale'){
39
  continue;
40
  }
@@ -79,6 +80,7 @@ if (!defined('ABSPATH')) {
79
  extract($extra_params);
80
  $render_saved_condition = true;
81
  include $template;
 
82
 
83
  ?>
84
  <div class="wdr-btn-remove" style="float: left">
@@ -99,6 +101,7 @@ if (!defined('ABSPATH')) {
99
  $i++;
100
  }
101
  }
 
102
  } ?>
103
  </div>
104
  <div class="add-condition add-condition-and-filters">
35
  $render_saved_condition = false;
36
  foreach ($conditions as $condition) {
37
  $type = isset($condition->type) ? $condition->type : NULL;
38
+ $custom_taxonomy_type_on_edit = $type;
39
  if($awdr_discount_type != 'wdr_free_shipping' && $type == 'cart_item_product_onsale'){
40
  continue;
41
  }
80
  extract($extra_params);
81
  $render_saved_condition = true;
82
  include $template;
83
+ $custom_taxonomy_type_on_edit = null;
84
 
85
  ?>
86
  <div class="wdr-btn-remove" style="float: left">
101
  $i++;
102
  }
103
  }
104
+ $custom_taxonomy_type_on_edit = null;
105
  } ?>
106
  </div>
107
  <div class="add-condition add-condition-and-filters">
v2/App/Views/Admin/Rules/Discounts/Bulk.php CHANGED
@@ -61,6 +61,8 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
61
  step="any"
62
  value="<?php if (isset($range_value->value) && !empty($range_value->value)) {
63
  echo $range_value->value;
 
 
64
  } ?>">
65
  <span class="wdr_desc_text"><?php _e('Discount Value', WDR_TEXT_DOMAIN); ?></span>
66
  </div>
61
  step="any"
62
  value="<?php if (isset($range_value->value) && !empty($range_value->value)) {
63
  echo $range_value->value;
64
+ }else{
65
+ echo 0;
66
  } ?>">
67
  <span class="wdr_desc_text"><?php _e('Discount Value', WDR_TEXT_DOMAIN); ?></span>
68
  </div>
v2/App/Views/Admin/Tabs/settings.php CHANGED
@@ -272,6 +272,18 @@
272
  for="dont_show_strikeout_on_cart"><?php _e('No', WDR_TEXT_DOMAIN); ?></label>
273
  </td>
274
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
275
  <tr>
276
  <td scope="row">
277
  <label for="" class="awdr-left-align"><?php _e('Combine all cart discounts', WDR_TEXT_DOMAIN) ?></label>
@@ -394,7 +406,7 @@
394
  <td>
395
  <textarea name="applied_rule_message"
396
  rows="5"
397
- cols="30"><?php echo $configuration->getConfig('applied_rule_message', 'You saved {{total_discount}}'); ?></textarea>
398
  </td>
399
  </tr>
400
  </tbody>
272
  for="dont_show_strikeout_on_cart"><?php _e('No', WDR_TEXT_DOMAIN); ?></label>
273
  </td>
274
  </tr>
275
+ <tr>
276
+ <td scope="row">
277
+ <label for="" class="awdr-left-align"><?php _e('Apply cart discount as', WDR_TEXT_DOMAIN) ?></label>
278
+ <span class="wdr_settings_desc_text awdr-clear-both"><?php esc_attr_e('Apply cart discount as fee/coupon', WDR_TEXT_DOMAIN); ?></span>
279
+ </td>
280
+ <td>
281
+ <select name="apply_cart_discount_as">
282
+ <option value="fee" <?php echo ($configuration->getConfig('apply_cart_discount_as', 'fee') == 'fee') ? 'selected' : ''; ?> ><?php _e('Fee', WDR_TEXT_DOMAIN); ?></option>
283
+ <option value="coupon" <?php echo ($configuration->getConfig('apply_cart_discount_as', 'fee') == 'coupon') ? 'selected' : ''; ?>><?php _e('Coupon', WDR_TEXT_DOMAIN); ?></option>
284
+ </select>
285
+ </td>
286
+ </tr>
287
  <tr>
288
  <td scope="row">
289
  <label for="" class="awdr-left-align"><?php _e('Combine all cart discounts', WDR_TEXT_DOMAIN) ?></label>
406
  <td>
407
  <textarea name="applied_rule_message"
408
  rows="5"
409
+ cols="30"><?php echo $configuration->getConfig('applied_rule_message', __('Discount <strong>{{title}}</strong> has been applied to your cart.', WDR_TEXT_DOMAIN)); ?></textarea>
410
  </td>
411
  </tr>
412
  </tbody>
v2/Assets/Js/admin_script.js CHANGED
@@ -1008,7 +1008,8 @@ jQuery(document).ready(function ($) {
1008
  $(element).find('.bulk_discount_min').css("border", "1px solid #7e8993");
1009
  $(element).find('.bulk_discount_max').css("border", "1px solid #7e8993");
1010
  }
1011
- if (max_val == '') {
 
1012
  discount_array.push("fails");
1013
  $(element).find('.bulk_discount_value').css("border", "1px solid red");
1014
  $(element).find('.bulk_discount_value').focus();
1008
  $(element).find('.bulk_discount_min').css("border", "1px solid #7e8993");
1009
  $(element).find('.bulk_discount_max').css("border", "1px solid #7e8993");
1010
  }
1011
+ let max_val_int = parseInt(max_val);
1012
+ if (max_val == '' || max_val_int < 0 ) {
1013
  discount_array.push("fails");
1014
  $(element).find('.bulk_discount_value').css("border", "1px solid red");
1015
  $(element).find('.bulk_discount_value').focus();
woo-discount-rules.php CHANGED
@@ -5,13 +5,13 @@
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 2.2.1
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
12
  * Requires at least: 4.6.1
13
  * WC requires at least: 3.0
14
- * WC tested up to: 4.4
15
  */
16
  if (!defined('ABSPATH')) {
17
  exit;
@@ -21,7 +21,7 @@ if (!defined('ABSPATH')) {
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
- define('WDR_VERSION', '2.2.1');
25
  }
26
 
27
  global $awdr_load_version;
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 2.2.2
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
12
  * Requires at least: 4.6.1
13
  * WC requires at least: 3.0
14
+ * WC tested up to: 4.5
15
  */
16
  if (!defined('ABSPATH')) {
17
  exit;
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
+ define('WDR_VERSION', '2.2.2');
25
  }
26
 
27
  global $awdr_load_version;