WooCommerce Extended Coupon Features - Version 3.0.4

Version Description

Release Date - 2018-10-12 * FIX: Auto coupons: silently remove invalid coupons * FIX: WPML compatibility issue with "CATEGORIES AND" * (PRO) FIX: CSS of the column system (box-sizing: border-box)

Download this release

Release Info

Developer josk79
Plugin Icon 128x128 WooCommerce Extended Coupon Features
Version 3.0.4
Comparing to
See all releases

Code changes from version 3.0.3 to 3.0.4

includes/plugins/WJECF_Autocoupon.php CHANGED
@@ -796,7 +796,11 @@ if ( defined( 'ABSPATH' ) && ! class_exists( 'WJECF_Autocoupon' ) ) {
796
  * @param array $valid_coupon_codes string[] Coupon codes that we know that are valid and don't need to be removed.
797
  * @return bool True if one or more coupons have been removed
798
  */
799
- private function remove_unmatched_autocoupons( $valid_coupon_codes = array() ) {
 
 
 
 
800
  //Remove invalids
801
  $calc_needed = false;
802
  foreach ( WC()->cart->get_applied_coupons() as $coupon_code ) {
@@ -862,6 +866,22 @@ if ( defined( 'ABSPATH' ) && ! class_exists( 'WJECF_Autocoupon' ) ) {
862
  return WJECF()->coupon_combination_filter( $valid_auto_coupons );
863
  }
864
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
865
  /**
866
  * Test whether the coupon is valid (to be auto-applied)
867
  *
796
  * @param array $valid_coupon_codes string[] Coupon codes that we know that are valid and don't need to be removed.
797
  * @return bool True if one or more coupons have been removed
798
  */
799
+ private function remove_unmatched_autocoupons( $valid_coupon_codes = null ) {
800
+ if ( is_null( $valid_coupon_codes ) ) {
801
+ $valid_coupon_codes = $this->get_valid_auto_coupon_codes();
802
+ }
803
+
804
  //Remove invalids
805
  $calc_needed = false;
806
  foreach ( WC()->cart->get_applied_coupons() as $coupon_code ) {
866
  return WJECF()->coupon_combination_filter( $valid_auto_coupons );
867
  }
868
 
869
+ /**
870
+ * Get all auto-coupons that are valid for the current cart.
871
+ *
872
+ * @return string[]
873
+ */
874
+ private function get_valid_auto_coupon_codes() {
875
+ //Get the coupons that should be in the cart
876
+ $valid_coupons = $this->get_valid_auto_coupons();
877
+
878
+ $valid_coupon_codes = array();
879
+ foreach ( $valid_coupons as $coupon ) {
880
+ $valid_coupon_codes[] = $coupon->get_code();
881
+ }
882
+ return $valid_coupon_codes;
883
+ }
884
+
885
  /**
886
  * Test whether the coupon is valid (to be auto-applied)
887
  *
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, coupons, discount
4
  Requires at least: 4.8
5
  Requires PHP: 5.4
6
  Tested up to: 4.9.9
7
- Stable tag: 3.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,7 +101,7 @@ On the settings page (Settings > WooCommerce Extended Coupon Features) check the
101
 
102
  == Changelog ==
103
 
104
- = 3.0.3 =
105
  *Release Date - 2018-10-12*
106
  * FIX: Auto coupons: silently remove invalid coupons
107
  * FIX: WPML compatibility issue with "CATEGORIES AND"
4
  Requires at least: 4.8
5
  Requires PHP: 5.4
6
  Tested up to: 4.9.9
7
+ Stable tag: 3.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
101
 
102
  == Changelog ==
103
 
104
+ = 3.0.4 =
105
  *Release Date - 2018-10-12*
106
  * FIX: Auto coupons: silently remove invalid coupons
107
  * FIX: WPML compatibility issue with "CATEGORIES AND"
woocommerce-jos-autocoupon.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Extended Coupon Features FREE
4
  * Plugin URI: http://www.soft79.nl
5
  * Description: Additional functionality for WooCommerce Coupons.
6
- * Version: 3.0.3
7
  * Author: Soft79
8
  * License: GPL2
9
  * WC requires at least: 3.0.0
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  }
16
 
17
  if ( ! defined( 'WJECF_VERSION' ) ) {
18
- define( 'WJECF_VERSION', '3.0.3' );
19
  }
20
 
21
  // NOTE: This file must be compatible with old PHP versions. All other files can be PHP 5.4+ .
3
  * Plugin Name: WooCommerce Extended Coupon Features FREE
4
  * Plugin URI: http://www.soft79.nl
5
  * Description: Additional functionality for WooCommerce Coupons.
6
+ * Version: 3.0.4
7
  * Author: Soft79
8
  * License: GPL2
9
  * WC requires at least: 3.0.0
15
  }
16
 
17
  if ( ! defined( 'WJECF_VERSION' ) ) {
18
+ define( 'WJECF_VERSION', '3.0.4' );
19
  }
20
 
21
  // NOTE: This file must be compatible with old PHP versions. All other files can be PHP 5.4+ .