Discount Rules for WooCommerce - Version 1.4.26

Version Description

  • 20/11/17 =
  • Fix Error occurred in Woocommerce 2.x
Download this release

Release Info

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

Code changes from version 1.4.25 to 1.4.26

includes/pricing-rules.php CHANGED
@@ -570,6 +570,42 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
570
  $this->rule_sets = $rule_sets;
571
  }
572
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  /**
574
  * Get all sub categories
575
  * */
570
  $this->rule_sets = $rule_sets;
571
  }
572
 
573
+ /**
574
+ * Check with users purchase history
575
+ * */
576
+ public function checkWithUsersPurchaseHistory($rule, $woocommerce)
577
+ {
578
+ $allowed = 'no';
579
+ $user = get_current_user_id();
580
+ if($user){
581
+ if(isset($rule->purchased_history_amount) && isset($rule->purchase_history_status_list)){
582
+ if($rule->purchased_history_amount > 0){
583
+ $purchase_history_status_list = json_decode($rule->purchase_history_status_list, true);
584
+ $customerOrders = get_posts( array(
585
+ 'numberposts' => -1,
586
+ 'meta_key' => '_customer_user',
587
+ 'meta_value' => $user,
588
+ 'post_type' => wc_get_order_types(),
589
+ 'post_status' => $purchase_history_status_list,
590
+ ) );
591
+ $totalPurchasedAmount = 0;
592
+ if(!empty($customerOrders)){
593
+ foreach ($customerOrders as $customerOrder) {
594
+ $order = wc_get_order($customerOrder->ID);
595
+ $total = $order->get_total();
596
+ $totalPurchasedAmount += $total;
597
+ }
598
+ }
599
+ if($totalPurchasedAmount >= $rule->purchased_history_amount){
600
+ $allowed = 'yes';
601
+ }
602
+ }
603
+ }
604
+ }
605
+
606
+ return $allowed;
607
+ }
608
+
609
  /**
610
  * Get all sub categories
611
  * */
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.25
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -176,6 +176,9 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
176
 
177
  == Changelog ==
178
 
 
 
 
179
  = 1.4.25 - 17/11/17 =
180
  * Fix – Error occurred in Woocommerce product list PRO
181
 
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.26
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
176
 
177
  == Changelog ==
178
 
179
+ = 1.4.26 - 20/11/17 =
180
+ * Fix – Error occurred in Woocommerce 2.x
181
+
182
  = 1.4.25 - 17/11/17 =
183
  * Fix – Error occurred in Woocommerce product list PRO
184
 
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.25
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.26
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1