Discount Rules for WooCommerce - Version 1.4.35

Version Description

  • 28/12/17 =
  • Fix - Rule not applied for specific product in cart
Download this release

Release Info

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

Code changes from version 1.4.34 to 1.4.35

helper/woo-function.php CHANGED
@@ -101,7 +101,16 @@ if(!class_exists('FlycartWoocommerceProduct')){
101
  * @return int
102
  */
103
  public static function get_parent_id($product){
104
- return FlycartWoocommerceVersion::wcVersion('3.0') ? $product->get_parent_id() : $product->parent_id;
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
  /**
101
  * @return int
102
  */
103
  public static function get_parent_id($product){
104
+ if(FlycartWoocommerceVersion::wcVersion('3.0') || method_exists($product, 'get_parent_id')){
105
+ return $product->get_parent_id();
106
+ } else {
107
+ if(isset($product->parent) && !empty($product->parent)){
108
+ if(isset($product->parent->id)){
109
+ return $product->parent->id;
110
+ }
111
+ }
112
+ return $product->parent_id;
113
+ }
114
  }
115
 
116
  /**
includes/pricing-rules.php CHANGED
@@ -1050,7 +1050,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1050
  $product_ids = array($product['product_id']);
1051
  if(!empty($product['variation_id'])) $product_ids[] = $product['variation_id'];
1052
  if (!is_array($product_list)) $product_list = (array)$product_list;
1053
- if (count(array_intersect($product_list, $product_ids)) == 1) {
1054
  return true;
1055
  } else {
1056
  return false;
@@ -1066,12 +1066,10 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1066
  */
1067
  public function isItemInCategoryList($category_list, $product)
1068
  {
1069
-
1070
  $helper = new FlycartWooDiscountRulesGeneralHelper();
1071
  $all_category = $helper->getCategoryList();
1072
  if (!isset($product['product_id'])) return false;
1073
  $product_category = FlycartWooDiscountRulesGeneralHelper::getCategoryByPost($product);
1074
-
1075
  $status = false;
1076
  //check any one of category matches
1077
  $matching_cats = array_intersect($product_category, $category_list);
@@ -1547,7 +1545,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
1547
 
1548
  // If Product having the rule sets then,
1549
  if (!isset($this->matched_sets[$cart_item_key])) return false;
1550
-
 
1551
  $adjustment_set = $this->matched_sets[$cart_item_key];
1552
  $product = $woocommerce->cart->cart_contents[$cart_item_key]['data'];
1553
  $price = FlycartWoocommerceProduct::get_price($product);
1050
  $product_ids = array($product['product_id']);
1051
  if(!empty($product['variation_id'])) $product_ids[] = $product['variation_id'];
1052
  if (!is_array($product_list)) $product_list = (array)$product_list;
1053
+ if (count(array_intersect($product_list, $product_ids)) >= 1) {
1054
  return true;
1055
  } else {
1056
  return false;
1066
  */
1067
  public function isItemInCategoryList($category_list, $product)
1068
  {
 
1069
  $helper = new FlycartWooDiscountRulesGeneralHelper();
1070
  $all_category = $helper->getCategoryList();
1071
  if (!isset($product['product_id'])) return false;
1072
  $product_category = FlycartWooDiscountRulesGeneralHelper::getCategoryByPost($product);
 
1073
  $status = false;
1074
  //check any one of category matches
1075
  $matching_cats = array_intersect($product_category, $category_list);
1545
 
1546
  // If Product having the rule sets then,
1547
  if (!isset($this->matched_sets[$cart_item_key])) return false;
1548
+ if (empty($this->matched_sets[$cart_item_key])) return false;
1549
+
1550
  $adjustment_set = $this->matched_sets[$cart_item_key];
1551
  $product = $woocommerce->cart->cart_contents[$cart_item_key]['data'];
1552
  $price = FlycartWoocommerceProduct::get_price($product);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
- Stable tag: 1.4.34
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -238,6 +238,9 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
238
 
239
  == Changelog ==
240
 
 
 
 
241
  = 1.4.34 - 22/12/17 =
242
  * Feature - Option to choose Guest in user role
243
 
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.9
7
+ Stable tag: 1.4.35
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
238
 
239
  == Changelog ==
240
 
241
+ = 1.4.35 - 28/12/17 =
242
+ * Fix - Rule not applied for specific product in cart
243
+
244
  = 1.4.34 - 22/12/17 =
245
  * Feature - Option to choose Guest in user role
246
 
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.4.34
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.35
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1