Discount Rules for WooCommerce - Version 1.9.6

Version Description

  • 23/03/20 =
  • Fix - Error displays (removed coupon) when disable third party coupon option is enabled.
  • Fix - Not saving the cart rule based on WPML language.
  • Fix - Display price suffix when there is no discount while having dynamic update option.
  • Improvement - Additional param in the event woo_discount_rules_load_original_price_on_get_cheapest_product.
  • Improvement - Discounted price in advance layout based on settings.
  • Improvement - Event apply_filters('woo_discount_rules_product_price_container_class', '').
Download this release

Release Info

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

Code changes from version 1.9.5 to 1.9.6

assets/js/woo_discount_rules.js CHANGED
@@ -13,7 +13,11 @@ jQuery( document ).ready( function() {
13
  var product_id = null;
14
  var current_object = jQuery(this);
15
  var quantity = jQuery(this).val();
16
- var target = jQuery(this).closest('.summary').find('.price');
 
 
 
 
17
  if(btn.length && parseInt(btn.val()) > 0){
18
  product_id = btn.val();
19
  if(!target.length){
13
  var product_id = null;
14
  var current_object = jQuery(this);
15
  var quantity = jQuery(this).val();
16
+ var target_class = '.summary';
17
+ if(woo_discount_rules.product_price_container_class !== undefined && woo_discount_rules.product_price_container_class !== ''){
18
+ target_class = woo_discount_rules.product_price_container_class;
19
+ }
20
+ var target = jQuery(this).closest(target_class).find('.price');
21
  if(btn.length && parseInt(btn.val()) > 0){
22
  product_id = btn.val();
23
  if(!target.length){
includes/cart-rules.php CHANGED
@@ -151,6 +151,7 @@ if (!class_exists('FlycartWooDiscountRulesCartRules')) {
151
  'status',
152
  'promotion_subtotal_from',
153
  'promotion_message',
 
154
  );
155
  $coupons_used = array();
156
  if($request['discount_type'] == 'product_discount'){
151
  'status',
152
  'promotion_subtotal_from',
153
  'promotion_message',
154
+ 'wpml_language'
155
  );
156
  $coupons_used = array();
157
  if($request['discount_type'] == 'product_discount'){
includes/discount-base.php CHANGED
@@ -1160,6 +1160,10 @@ if (!class_exists('FlycartWooDiscountBase')) {
1160
  $has_price_rules = $this->hasPriceRules();
1161
  $has_cart_rules = $this->hasCartRules();
1162
  $used_coupons = FlycartWooDiscountRulesGeneralHelper::getUsedCouponsInRules();
 
 
 
 
1163
  $applied_coupon = FlycartWooDiscountRulesCartRules::getAppliedCoupons();
1164
  if(!empty($used_coupons) && is_array($used_coupons)){
1165
  $applied_coupon = array_merge($applied_coupon, $used_coupons);
1160
  $has_price_rules = $this->hasPriceRules();
1161
  $has_cart_rules = $this->hasCartRules();
1162
  $used_coupons = FlycartWooDiscountRulesGeneralHelper::getUsedCouponsInRules();
1163
+ $cartRules = new FlycartWooDiscountRulesCartRules();
1164
+ $coupon_code_by_cart_rule = $cartRules->getCouponCode();
1165
+ $coupon_code_by_cart_rule = strtolower($coupon_code_by_cart_rule);
1166
+ $used_coupons[] = $coupon_code_by_cart_rule;
1167
  $applied_coupon = FlycartWooDiscountRulesCartRules::getAppliedCoupons();
1168
  if(!empty($used_coupons) && is_array($used_coupons)){
1169
  $applied_coupon = array_merge($applied_coupon, $used_coupons);
includes/pricing-rules.php CHANGED
@@ -2382,7 +2382,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2382
 
2383
  $_product = $values['data'];
2384
  $productId = FlycartWoocommerceProduct::get_id($_product);
2385
- $loadOriginalPrice = apply_filters('woo_discount_rules_load_original_price_on_get_cheapest_product', false);
2386
  if($loadOriginalPrice){
2387
  $_product = FlycartWoocommerceProduct::wc_get_product($productId);
2388
  }
@@ -4281,7 +4281,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
4281
  $html .= '<span class="price">';
4282
  }
4283
  $html .= "<del>".FlycartWoocommerceProduct::wc_price($regular_price)."</del>";
4284
- $html .= "<ins>".FlycartWoocommerceProduct::wc_price($sale_price)."</ins>";
4285
  if($product_type == 'variation'){
4286
  $html .= '</span>';
4287
  }
@@ -4293,7 +4293,7 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
4293
  if($product_type == 'variation'){
4294
  $html = '<span class="price">';
4295
  }
4296
- $html .= FlycartWoocommerceProduct::wc_price($sale_price);
4297
  if($product_type == 'variation'){
4298
  $html .= '</span>';
4299
  }
2382
 
2383
  $_product = $values['data'];
2384
  $productId = FlycartWoocommerceProduct::get_id($_product);
2385
+ $loadOriginalPrice = apply_filters('woo_discount_rules_load_original_price_on_get_cheapest_product', false, $values);
2386
  if($loadOriginalPrice){
2387
  $_product = FlycartWoocommerceProduct::wc_get_product($productId);
2388
  }
4281
  $html .= '<span class="price">';
4282
  }
4283
  $html .= "<del>".FlycartWoocommerceProduct::wc_price($regular_price)."</del>";
4284
+ $html .= "<ins>".FlycartWoocommerceProduct::wc_price($sale_price).$product->get_price_suffix($sale_price)."</ins>";
4285
  if($product_type == 'variation'){
4286
  $html .= '</span>';
4287
  }
4293
  if($product_type == 'variation'){
4294
  $html = '<span class="price">';
4295
  }
4296
+ $html .= FlycartWoocommerceProduct::wc_price($sale_price).$product->get_price_suffix($sale_price);
4297
  if($product_type == 'variation'){
4298
  $html .= '</span>';
4299
  }
loader.php CHANGED
@@ -585,7 +585,8 @@ if(!class_exists('FlycartWooDiscountRules')){
585
  'home_url' => get_home_url(),
586
  'admin_url' => admin_url(),
587
  'ajax_url' => admin_url('admin-ajax.php'),
588
- 'show_product_strikeout' => $this->discountBase->getConfigData('show_price_discount_on_product_page', 'show')
 
589
  ));
590
  wp_enqueue_script( 'woo_discount_rules_site');
591
  }
585
  'home_url' => get_home_url(),
586
  'admin_url' => admin_url(),
587
  'ajax_url' => admin_url('admin-ajax.php'),
588
+ 'show_product_strikeout' => $this->discountBase->getConfigData('show_price_discount_on_product_page', 'show'),
589
+ 'product_price_container_class' => apply_filters('woo_discount_rules_product_price_container_class', ''),
590
  ));
591
  wp_enqueue_script( 'woo_discount_rules_site');
592
  }
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.3
7
- Stable tag: 1.9.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -336,6 +336,14 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
 
 
339
  = 1.9.5 - 19/02/20 =
340
  * Fix - Strikeout for On after apply discount option doesn't works with non cumulative options.
341
  * Improvement - Text improvements
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.3
7
+ Stable tag: 1.9.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
336
 
337
  == Changelog ==
338
 
339
+ = 1.9.6 - 23/03/20 =
340
+ * Fix - Error displays (removed coupon) when disable third party coupon option is enabled.
341
+ * Fix - Not saving the cart rule based on WPML language.
342
+ * Fix - Display price suffix when there is no discount while having dynamic update option.
343
+ * Improvement - Additional param in the event woo_discount_rules_load_original_price_on_get_cheapest_product.
344
+ * Improvement - Discounted price in advance layout based on settings.
345
+ * Improvement - Event apply_filters('woo_discount_rules_product_price_container_class', '').
346
+
347
  = 1.9.5 - 19/02/20 =
348
  * Fix - Strikeout for On after apply discount option doesn't works with non cumulative options.
349
  * Improvement - Text improvements
vendor/yahnis-elsts/plugin-update-checker/languages/plugin-update-checker-cs_CZ.po CHANGED
@@ -1,45 +1,45 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: plugin-update-checker\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2017-05-20 10:53+0300\n"
6
- "PO-Revision-Date: 2017-07-05 15:39+0000\n"
7
- "Last-Translator: Vojtěch Sajdl <vojtech@sajdl.com>\n"
8
- "Language-Team: Czech (Czech Republic)\n"
9
- "Language: cs-CZ\n"
10
- "Plural-Forms: nplurals=2; plural=(n != 1)\n"
11
- "MIME-Version: 1.0\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
- "Content-Transfer-Encoding: 8bit\n"
14
- "X-Loco-Source-Locale: cs_CZ\n"
15
- "X-Generator: Loco - https://localise.biz/\n"
16
- "X-Poedit-Basepath: ..\n"
17
- "X-Poedit-SourceCharset: UTF-8\n"
18
- "X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n"
19
- "X-Poedit-SearchPath-0: .\n"
20
- "X-Loco-Parser: loco_parse_po"
21
-
22
- #: Puc/v4p1/Plugin/UpdateChecker.php:358
23
- msgid "Check for updates"
24
- msgstr "Zkontrolovat aktualizace"
25
-
26
- #: Puc/v4p1/Plugin/UpdateChecker.php:405
27
- #, php-format
28
- msgctxt "the plugin title"
29
- msgid "The %s plugin is up to date."
30
- msgstr "Plugin %s je aktuální."
31
-
32
- #: Puc/v4p1/Plugin/UpdateChecker.php:407
33
- #, php-format
34
- msgctxt "the plugin title"
35
- msgid "A new version of the %s plugin is available."
36
- msgstr "Nová verze pluginu %s je dostupná."
37
-
38
- #: Puc/v4p1/Plugin/UpdateChecker.php:409
39
- #, php-format
40
- msgid "Unknown update checker status \"%s\""
41
- msgstr "Neznámý status kontroly aktualizací \"%s\""
42
-
43
- #: Puc/v4p1/Vcs/PluginUpdateChecker.php:83
44
- msgid "There is no changelog available."
45
- msgstr "Changelog není dostupný."
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: plugin-update-checker\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2017-05-20 10:53+0300\n"
6
+ "PO-Revision-Date: 2017-07-05 15:39+0000\n"
7
+ "Last-Translator: Vojtěch Sajdl <vojtech@sajdl.com>\n"
8
+ "Language-Team: Czech (Czech Republic)\n"
9
+ "Language: cs-CZ\n"
10
+ "Plural-Forms: nplurals=2; plural=(n != 1)\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "X-Loco-Source-Locale: cs_CZ\n"
15
+ "X-Generator: Loco - https://localise.biz/\n"
16
+ "X-Poedit-Basepath: ..\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;_x:1,2c;_x\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Loco-Parser: loco_parse_po"
21
+
22
+ #: Puc/v4p1/Plugin/UpdateChecker.php:358
23
+ msgid "Check for updates"
24
+ msgstr "Zkontrolovat aktualizace"
25
+
26
+ #: Puc/v4p1/Plugin/UpdateChecker.php:405
27
+ #, php-format
28
+ msgctxt "the plugin title"
29
+ msgid "The %s plugin is up to date."
30
+ msgstr "Plugin %s je aktuální."
31
+
32
+ #: Puc/v4p1/Plugin/UpdateChecker.php:407
33
+ #, php-format
34
+ msgctxt "the plugin title"
35
+ msgid "A new version of the %s plugin is available."
36
+ msgstr "Nová verze pluginu %s je dostupná."
37
+
38
+ #: Puc/v4p1/Plugin/UpdateChecker.php:409
39
+ #, php-format
40
+ msgid "Unknown update checker status \"%s\""
41
+ msgstr "Neznámý status kontroly aktualizací \"%s\""
42
+
43
+ #: Puc/v4p1/Vcs/PluginUpdateChecker.php:83
44
+ msgid "There is no changelog available."
45
+ msgstr "Changelog není dostupný."
view/settings_general.php CHANGED
@@ -14,36 +14,41 @@ if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
  </label>
15
  </div>
16
  <div class="col-md-6">
17
- <input type="text" class="" name="license_key" id="woo-disc-license-key"
18
- value="<?php if (isset($data['license_key'])) echo $data['license_key']; ?>"
19
- placeholder="<?php esc_attr_e('Your Unique License Key', 'woo-discount-rules'); ?>">
20
- <input type="button" id="woo-disc-license-check" value="<?php esc_attr_e('Validate Key', 'woo-discount-rules'); ?>" class="button button-info">
21
- <?php
22
- $verifiedLicense = get_option('woo_discount_rules_verified_key', 0);
23
- if (isset($data['license_key']) && $data['license_key'] != '') {
24
- if ($verifiedLicense) {
25
- ?>
26
- <span class="license-success">&#10004;</span>
27
- <?php
28
- } else {
29
- ?>
30
- <div class="license-failed notice-message error inline notice-error notice-alt">
31
- <?php esc_html_e('License key seems to be Invalid. Please enter a valid license key', 'woo-discount-rules'); ?>
32
- </div>
33
- <?php
 
 
34
  }
35
- }
36
- ?>
37
- <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('introduction/license-key-activation', 'license'); ?>
38
- <br>
39
- <div id="woo-disc-license-check-msg">
40
 
41
- </div>
42
- <div class="wdr_desc_text_con">
43
  <span class="wdr_desc_text">
44
  <?php esc_html_e('Tip: Install pro package before validating the licence', 'woo-discount-rules'); ?>
45
  </span>
46
- </div>
 
 
 
 
47
  </div>
48
  </div>
49
  <div class="row form-group">
14
  </label>
15
  </div>
16
  <div class="col-md-6">
17
+ <?php if($isPro){ ?>
18
+ <input type="text" class="" name="license_key" id="woo-disc-license-key"
19
+ value="<?php if (isset($data['license_key'])) echo $data['license_key']; ?>"
20
+ placeholder="<?php esc_attr_e('Your Unique License Key', 'woo-discount-rules'); ?>">
21
+ <input type="button" id="woo-disc-license-check" value="<?php esc_attr_e('Validate Key', 'woo-discount-rules'); ?>" class="button button-info">
22
+ <?php
23
+ $verifiedLicense = get_option('woo_discount_rules_verified_key', 0);
24
+ if (isset($data['license_key']) && $data['license_key'] != '') {
25
+ if ($verifiedLicense) {
26
+ ?>
27
+ <span class="license-success">&#10004;</span>
28
+ <?php
29
+ } else {
30
+ ?>
31
+ <div class="license-failed notice-message error inline notice-error notice-alt">
32
+ <?php esc_html_e('License key seems to be Invalid. Please enter a valid license key', 'woo-discount-rules'); ?>
33
+ </div>
34
+ <?php
35
+ }
36
  }
37
+ ?>
38
+ <?php echo FlycartWooDiscountRulesGeneralHelper::docsURLHTML('introduction/license-key-activation', 'license'); ?>
39
+ <br>
40
+ <div id="woo-disc-license-check-msg">
 
41
 
42
+ </div>
43
+ <div class="wdr_desc_text_con">
44
  <span class="wdr_desc_text">
45
  <?php esc_html_e('Tip: Install pro package before validating the licence', 'woo-discount-rules'); ?>
46
  </span>
47
+ </div>
48
+ <?php } else { ?>
49
+ <?php esc_html_e('Install pro package for validating the licence', 'woo-discount-rules'); ?>
50
+ <?php } ?>
51
+
52
  </div>
53
  </div>
54
  <div class="row form-group">
view/template/discount-table-advance.php CHANGED
@@ -10,7 +10,23 @@ if (!isset($table_data) || empty($table_data)) return false;
10
  $base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data) ? $data : array());
11
  $discount_rules = $table_data;
12
  $discount_rules_displayed = array();
13
- $product_price = $product->get_price();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  $searchForReplace = array('{{title}}', '{{description}}', '{{min_quantity}}', '{{max_quantity}}', '{{discount}}', '{{discounted_price}}', '{{condition}}');
15
  $i = 1;
16
  ?>
10
  $base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data) ? $data : array());
11
  $discount_rules = $table_data;
12
  $discount_rules_displayed = array();
13
+ $do_discount_from_regular_price = isset($base_config['do_discount_from_regular_price'])? $base_config['do_discount_from_regular_price']: 'sale';
14
+ if(class_exists('FlycartWoocommerceProduct')){
15
+ if($do_discount_from_regular_price == "regular"){
16
+ if ($product->is_type(array('variable', 'variable-subscription'))) {
17
+ if(method_exists($product, 'get_variation_regular_price')){
18
+ $product_price = $product->get_variation_regular_price('min');
19
+ }
20
+ } else {
21
+ $product_price = FlycartWoocommerceProduct::get_regular_price($product);
22
+ }
23
+ } else {
24
+ $product_price = FlycartWoocommerceProduct::get_price($product);
25
+ }
26
+ } else {
27
+ $product_price = $product->get_price();
28
+ }
29
+
30
  $searchForReplace = array('{{title}}', '{{description}}', '{{min_quantity}}', '{{max_quantity}}', '{{discount}}', '{{discounted_price}}', '{{condition}}');
31
  $i = 1;
32
  ?>
woo-discount-rules.php CHANGED
@@ -5,13 +5,13 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.9.5
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: 2.4
14
- * WC tested up to: 3.9
15
  */
16
 
17
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.9.6
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: 2.4
14
+ * WC tested up to: 4.0
15
  */
16
 
17
  if (!defined('ABSPATH')) exit; // Exit if accessed directly