Discount Rules for WooCommerce - Version 2.5.2

Version Description

  • 09/11/22 =
  • Improvement: Event: advanced_woo_discount_rules_exclude_coupon_while_remove_third_party_coupon [Core].
  • Improvement: Updated code on check free shipping [Core].
  • Add: Support for WordPress 6.1 [Core and Pro].
  • Fix: SKU filter displays wrong value, when having space in SKU [Pro].
Download this release

Release Info

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

Code changes from version 2.5.0 to 2.5.2

readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: flycart
3
  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: 6.0
7
- Stable tag: 2.5.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -336,6 +336,12 @@ Note : Enable recursive checkbox if the discounts should be applied in sequentia
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
339
  = 2.5.0 - 01/11/22 =
340
  * Improvement: Added applied discount info in order and order item meta _wdr_discounts [Core and Pro].
341
  * Improvement: Loading issue on shop page while having variable price strikeout improvement [Core].
3
  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: 6.1
7
+ Stable tag: 2.5.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.5.2 - 09/11/22 =
340
+ * Improvement: Event: advanced_woo_discount_rules_exclude_coupon_while_remove_third_party_coupon [Core].
341
+ * Improvement: Updated code on check free shipping [Core].
342
+ * Add: Support for WordPress 6.1 [Core and Pro].
343
+ * Fix: SKU filter displays wrong value, when having space in SKU [Pro].
344
+
345
  = 2.5.0 - 01/11/22 =
346
  * Improvement: Added applied discount info in order and order item meta _wdr_discounts [Core and Pro].
347
  * Improvement: Loading issue on shop page while having variable price strikeout improvement [Core].
v2/App/Controllers/DiscountCalculator.php CHANGED
@@ -1086,39 +1086,34 @@ class DiscountCalculator extends Base
1086
  * @return array
1087
  */
1088
  public static function getFreeshippingMethod(){
1089
- /* For filter exclusive rule */
1090
- $manage_discount = Router::$manage_discount;
1091
- $discount_calculator = $manage_discount::$calculator;
1092
- $discount_calculator->filterExclusiveRule(1, false, true, false);
1093
- foreach (self::$rules as $rule) {
1094
- $language_helper_object = self::$language_helper;
1095
- $chosen_languages = $rule->getLanguages();
1096
- if (!empty($chosen_languages)) {
1097
- $current_language = $language_helper_object::getCurrentLanguage();
1098
- if (!in_array($current_language, $chosen_languages)) {
1099
- continue;
 
 
 
1100
  }
1101
- }
1102
- //$rule_id = $rule->getId();
1103
- $discount_type = $rule->getRuleDiscountType();
1104
- $rule_id = $rule->rule->id;
1105
- if ($discount_type == "wdr_free_shipping") {
1106
- $cart_items = self::$woocommerce_helper->getCart();
1107
- if(!empty($cart_items)){
1108
- foreach ($cart_items as $cart_item){
1109
- //if ($rule->isFilterPassed($cart_item['data'])) {
1110
- if ($rule->hasConditions()) {
1111
- if (!$rule->isCartConditionsPassed($cart_items)) {
1112
- continue;
1113
- }
1114
  }
 
1115
 
1116
- if (self::$woocommerce_helper->isCartNeedsShipping()) {
1117
- self::$applied_rules[$rule_id] = self::$rules[$rule_id];
1118
- }
1119
- return array('free_shipping'=>1);
1120
- //}
1121
  }
 
1122
  }
1123
  }
1124
  }
1086
  * @return array
1087
  */
1088
  public static function getFreeshippingMethod(){
1089
+ $cart_items = self::$woocommerce_helper->getCart();
1090
+ if(!empty($cart_items)){
1091
+ /* For filter exclusive rule */
1092
+ $manage_discount = Router::$manage_discount;
1093
+ $discount_calculator = $manage_discount::$calculator;
1094
+ $discount_calculator->filterExclusiveRule(1, false, true, false);
1095
+ foreach (self::$rules as $rule) {
1096
+ $language_helper_object = self::$language_helper;
1097
+ $chosen_languages = $rule->getLanguages();
1098
+ if (!empty($chosen_languages)) {
1099
+ $current_language = $language_helper_object::getCurrentLanguage();
1100
+ if (!in_array($current_language, $chosen_languages)) {
1101
+ continue;
1102
+ }
1103
  }
1104
+ $discount_type = $rule->getRuleDiscountType();
1105
+ $rule_id = $rule->rule->id;
1106
+ if ($discount_type == "wdr_free_shipping") {
1107
+ if ($rule->hasConditions()) {
1108
+ if (!$rule->isCartConditionsPassed($cart_items)) {
1109
+ continue;
 
 
 
 
 
 
 
1110
  }
1111
+ }
1112
 
1113
+ if (self::$woocommerce_helper->isCartNeedsShipping()) {
1114
+ self::$applied_rules[$rule_id] = self::$rules[$rule_id];
 
 
 
1115
  }
1116
+ return array('free_shipping' => 1);
1117
  }
1118
  }
1119
  }
v2/App/Controllers/ManageDiscount.php CHANGED
@@ -1311,7 +1311,10 @@ class ManageDiscount extends Base
1311
  }
1312
  foreach ($applied_coupons as $applied_coupon){
1313
  if(empty($used_coupons) || !in_array($applied_coupon, $used_coupons)){
1314
- $this->removeAppliedCoupon($applied_coupon);
 
 
 
1315
  }
1316
  }
1317
  }
1311
  }
1312
  foreach ($applied_coupons as $applied_coupon){
1313
  if(empty($used_coupons) || !in_array($applied_coupon, $used_coupons)){
1314
+ $exclude_coupon = apply_filters('advanced_woo_discount_rules_exclude_coupon_while_remove_third_party_coupon', false, $applied_coupon);
1315
+ if ($exclude_coupon === false) {
1316
+ $this->removeAppliedCoupon($applied_coupon);
1317
+ }
1318
  }
1319
  }
1320
  }
v2/App/Helpers/Helper.php CHANGED
@@ -332,9 +332,9 @@ class Helper
332
 
333
  public static function displayCompatibleCheckMessages()
334
  {
335
- if (version_compare(WDR_VERSION, '2.5.0', '>=')) {
336
  if (defined('WDR_PRO_VERSION')) {
337
- if (version_compare(WDR_PRO_VERSION, '2.5.0', '<')) {
338
  $url = esc_url(admin_url() . "plugins.php");
339
  $plugin_page = '<a target="_blank" href="' . $url . '">' . __('Update now', 'woo-discount-rules') . '</a>';
340
  ?>
332
 
333
  public static function displayCompatibleCheckMessages()
334
  {
335
+ if (version_compare(WDR_VERSION, '2.5.2', '>=')) {
336
  if (defined('WDR_PRO_VERSION')) {
337
+ if (version_compare(WDR_PRO_VERSION, '2.5.2', '<')) {
338
  $url = esc_url(admin_url() . "plugins.php");
339
  $plugin_page = '<a target="_blank" href="' . $url . '">' . __('Update now', 'woo-discount-rules') . '</a>';
340
  ?>
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
7
  * Author URI: https://www.flycart.org
8
- * Version: 2.5.0
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: 7.0
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.5.0');
25
  }
26
 
27
  global $awdr_load_version;
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart
7
  * Author URI: https://www.flycart.org
8
+ * Version: 2.5.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: 7.1
15
  */
16
  if (!defined('ABSPATH')) {
17
  exit;
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
+ define('WDR_VERSION', '2.5.2');
25
  }
26
 
27
  global $awdr_load_version;