Discount Rules for WooCommerce - Version 1.4.2

Version Description

Download this release

Release Info

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

Code changes from version 1.4.1 to 1.4.2

includes/cart-rules.php CHANGED
@@ -322,7 +322,7 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
322
  $coupon = 'Discount';
323
 
324
  // Verify and overwrite the Coupon Code.
325
- if (isset($config['coupon_name'])) $coupon = $config['coupon_name'];
326
  return $coupon;
327
  }
328
 
@@ -446,7 +446,6 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
446
  if (is_null($rules) || !isset($rules)) return false;
447
  // Start with empty set.
448
  $rule_set = array();
449
-
450
  foreach ($rules as $index => $rule) {
451
  $status = (isset($rule->status) ? $rule->status : false);
452
 
@@ -457,7 +456,7 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
457
  $today = strtotime(date('m/d/Y'));
458
 
459
  // Validating Rule with Date of Expiry.
460
- if (($date_from <= $today) && ($date_to > $today)) {
461
 
462
  // Validating the Rule with its Order ID.
463
  if (isset($rule->rule_order)) {
@@ -642,9 +641,10 @@ if (!class_exists('woo_dicount_rules_cartRules')) {
642
  return true;
643
  break;
644
  case 'shipping_countries_in':
645
- $user_meta = get_user_meta(get_current_user_id());
646
-
647
- if (!$user_meta || !isset($user_meta['shipping_country']) || empty($user_meta['shipping_country']) || !in_array($user_meta['shipping_country'][0], $rule)) {
 
648
  return false;
649
  }
650
  return true;
322
  $coupon = 'Discount';
323
 
324
  // Verify and overwrite the Coupon Code.
325
+ if (isset($config['coupon_name']) && $config['coupon_name'] != '') $coupon = $config['coupon_name'];
326
  return $coupon;
327
  }
328
 
446
  if (is_null($rules) || !isset($rules)) return false;
447
  // Start with empty set.
448
  $rule_set = array();
 
449
  foreach ($rules as $index => $rule) {
450
  $status = (isset($rule->status) ? $rule->status : false);
451
 
456
  $today = strtotime(date('m/d/Y'));
457
 
458
  // Validating Rule with Date of Expiry.
459
+ if ((($date_from <= $today) && ($date_to >= $today)) || ($date_from == '' && $date_to == '')) {
460
 
461
  // Validating the Rule with its Order ID.
462
  if (isset($rule->rule_order)) {
641
  return true;
642
  break;
643
  case 'shipping_countries_in':
644
+ // $user_meta = get_user_meta(get_current_user_id());
645
+ $shippingCountry = WC()->customer->get_shipping_country();
646
+ // if (!$user_meta || !isset($user_meta['shipping_country']) || empty($user_meta['shipping_country']) || !in_array($user_meta['shipping_country'][0], $rule)) {
647
+ if (empty($shippingCountry) || !in_array($shippingCountry, $rule)) {
648
  return false;
649
  }
650
  return true;
loader.php CHANGED
@@ -3,7 +3,7 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
  /**
4
  * Version of Woo Discount Rules.
5
  */
6
- define('WOO_DISCOUNT_VERSION', '1.4.1');
7
  /**
8
  * Required Version of WooCommerce to Run.
9
  */
3
  /**
4
  * Version of Woo Discount Rules.
5
  */
6
+ define('WOO_DISCOUNT_VERSION', '1.4.2');
7
  /**
8
  * Required Version of WooCommerce to Run.
9
  */
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.7
7
- Stable tag: 1.4.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
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.7
7
+ Stable tag: 1.4.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
view/view-cart-rules.php CHANGED
@@ -384,7 +384,7 @@ if (empty($discount_rules)) {
384
  ?>
385
  <div id="general_<?php echo $i; ?>" <?php echo $class; ?>>
386
  <input type="text"
387
- value="<?php echo(isset($discount_rules['subtotal_least']) ? $discount_rules['subtotal_least'] : ''); ?>"
388
  name="discount_rule[<?php echo $i; ?>][option_value]">
389
  </div>
390
  </label>
384
  ?>
385
  <div id="general_<?php echo $i; ?>" <?php echo $class; ?>>
386
  <input type="text"
387
+ value="<?php echo(isset($discount_rules[$type]) && !is_array($discount_rules[$type]) ? $discount_rules[$type] : ''); ?>"
388
  name="discount_rule[<?php echo $i; ?>][option_value]">
389
  </div>
390
  </label>
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.1
9
  * Requires at least: 4.6.1
10
  */
11
 
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.2
9
  * Requires at least: 4.6.1
10
  */
11