Discount Rules for WooCommerce - Version 1.7.16

Version Description

  • 12/06/19 =
  • Fix - Coupon not applied while coupon name added with space.
  • Improvement - Event apply_filters('woo_discount_rules_load_price_discount_strikeout_from_variant_for_single_price_variable_products', true, $product);
Download this release

Release Info

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

Code changes from version 1.7.15 to 1.7.16

assets/css/style.css CHANGED
@@ -207,4 +207,7 @@ span.wdr_block_span{
207
  }
208
  .price_rules_s_block_c{
209
  margin-top: 25px;
 
 
 
210
  }
207
  }
208
  .price_rules_s_block_c{
209
  margin-top: 25px;
210
+ }
211
+ form#discount_config .fade.show{
212
+ opacity: 1;
213
  }
includes/discount-base.php CHANGED
@@ -465,6 +465,10 @@ if (!class_exists('FlycartWooDiscountBase')) {
465
  parse_str($request['data'], $params);
466
  }
467
 
 
 
 
 
468
  if (is_array($request)) {
469
  if(isset($params['show_draft']) && $params['show_draft']){
470
  $params['show_draft'] = 1;
@@ -1151,5 +1155,18 @@ if (!class_exists('FlycartWooDiscountBase')) {
1151
 
1152
  return true;
1153
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1154
  }
1155
  }
465
  parse_str($request['data'], $params);
466
  }
467
 
468
+ if(isset($params['coupon_name'])){
469
+ $params['coupon_name'] = trim($params['coupon_name']);
470
+ }
471
+
472
  if (is_array($request)) {
473
  if(isset($params['show_draft']) && $params['show_draft']){
474
  $params['show_draft'] = 1;
1155
 
1156
  return true;
1157
  }
1158
+
1159
+ /**
1160
+ * To display settings link in plugin page
1161
+ *
1162
+ * @param array $links
1163
+ * @return array
1164
+ * */
1165
+ public static function addActionLinksInPluginPage($links){
1166
+ $mewlinks = array(
1167
+ '<a href="' . admin_url("admin.php?page=woo_discount_rules&tab=settings"). '">'.esc_html__('Settings', 'woo-discount-rules').'</a>',
1168
+ );
1169
+ return array_merge( $links, $mewlinks );
1170
+ }
1171
  }
1172
  }
includes/pricing-rules.php CHANGED
@@ -3803,16 +3803,19 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
3803
  $price_to_display .= ' - '.$greatestDiscountPrice;
3804
  }
3805
  } else {
3806
- if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
3807
- if ( ! empty( $child_prices ) ) {
3808
- $child_products = array_keys($child_prices);
3809
- if(isset($child_products[0])){
3810
- $product_new = FlycartWoocommerceProduct::wc_get_product($child_products[0]);
3811
- $discountPrice = $this->getDiscountPriceForTheProduct($product_new);
3812
- if($discountPrice <= 0 || !($this->hasDiscountForProductId($child_products[0]))){
3813
- $show_original = 1;
3814
- } else {
3815
- $price_to_display = FlycartWoocommerceProduct::wc_price($discountPrice);
 
 
 
3816
  }
3817
  }
3818
  }
3803
  $price_to_display .= ' - '.$greatestDiscountPrice;
3804
  }
3805
  } else {
3806
+ $load_from_variant = apply_filters('woo_discount_rules_load_price_discount_strikeout_from_variant_for_single_price_variable_products', true, $product);
3807
+ if($load_from_variant){
3808
+ if($product->is_type(array('variable', 'subscription_variation', 'variable-subscription'))){
3809
+ if ( ! empty( $child_prices ) ) {
3810
+ $child_products = array_keys($child_prices);
3811
+ if(isset($child_products[0])){
3812
+ $product_new = FlycartWoocommerceProduct::wc_get_product($child_products[0]);
3813
+ $discountPrice = $this->getDiscountPriceForTheProduct($product_new);
3814
+ if($discountPrice <= 0 || !($this->hasDiscountForProductId($child_products[0]))){
3815
+ $show_original = 1;
3816
+ } else {
3817
+ $price_to_display = FlycartWoocommerceProduct::wc_price($discountPrice);
3818
+ }
3819
  }
3820
  }
3821
  }
loader.php CHANGED
@@ -11,11 +11,6 @@ define('WOO_DISCOUNT_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
11
  */
12
  define('WOO_DISCOUNT_URI', untrailingslashit(plugin_dir_url(__FILE__)));
13
 
14
- /**
15
- * Plugin Base Name.
16
- */
17
- define('WOO_DISCOUNT_PLUGIN_BASENAME', plugin_basename(__FILE__));
18
-
19
  if(!function_exists('get_plugin_data')){
20
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
21
  }
@@ -141,6 +136,7 @@ if(!class_exists('FlycartWooDiscountRules')){
141
  if(in_array($display_you_saved_text, array('after_total', 'both_line_item_and_after_total'))){
142
  add_action( 'woocommerce_admin_order_totals_after_total', array( $this->pricingRules, 'displayTotalSavingsThroughDiscountInOrder'), 10);
143
  }
 
144
  }
145
 
146
  /**
11
  */
12
  define('WOO_DISCOUNT_URI', untrailingslashit(plugin_dir_url(__FILE__)));
13
 
 
 
 
 
 
14
  if(!function_exists('get_plugin_data')){
15
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
16
  }
136
  if(in_array($display_you_saved_text, array('after_total', 'both_line_item_and_after_total'))){
137
  add_action( 'woocommerce_admin_order_totals_after_total', array( $this->pricingRules, 'displayTotalSavingsThroughDiscountInOrder'), 10);
138
  }
139
+ add_filter( 'plugin_action_links_' . WOO_DISCOUNT_PLUGIN_BASENAME, array('FlycartWooDiscountBase', 'addActionLinksInPluginPage') );
140
  }
141
 
142
  /**
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.2
7
- Stable tag: 1.7.15
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -312,6 +312,10 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
312
 
313
  == Changelog ==
314
 
 
 
 
 
315
  = 1.7.15 - 28/05/19 =
316
  * Fix - Load coupon based on post title in multi select ajax
317
  * Improvement - Event apply_filters('woo_discount_rules_load_product_price_discount_based_on_tax_in_product_page', true, $cart_item);
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.2
7
+ Stable tag: 1.7.16
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
312
 
313
  == Changelog ==
314
 
315
+ = 1.7.16 - 12/06/19 =
316
+ * Fix - Coupon not applied while coupon name added with space.
317
+ * Improvement - Event apply_filters('woo_discount_rules_load_price_discount_strikeout_from_variant_for_single_price_variable_products', true, $product);
318
+
319
  = 1.7.15 - 28/05/19 =
320
  * Fix - Load coupon based on post title in multi select ajax
321
  * Improvement - Event apply_filters('woo_discount_rules_load_product_price_discount_based_on_tax_in_product_page', true, $cart_item);
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.7.15
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
@@ -16,6 +16,11 @@
16
 
17
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
18
 
 
 
 
 
 
19
  include_once(dirname(__FILE__).'/helper/activation-helper.php');
20
 
21
  include_once(dirname(__FILE__).'/loader.php');
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.7.16
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
16
 
17
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
18
 
19
+ /**
20
+ * Plugin Base Name.
21
+ */
22
+ define('WOO_DISCOUNT_PLUGIN_BASENAME', plugin_basename(__FILE__));
23
+
24
  include_once(dirname(__FILE__).'/helper/activation-helper.php');
25
 
26
  include_once(dirname(__FILE__).'/loader.php');