WooCommerce Extended Coupon Features - Version 3.1.2

Version Description

Release Date - 2019-09-18 * (PRO) FEATURE: Filter wjecf_is_first_purchase

Download this release

Release Info

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

Code changes from version 3.1.0 to 3.1.2

includes/class-wjecf-controller.php CHANGED
@@ -804,15 +804,18 @@ class WJECF_Controller {
804
  /**
805
  * Return an array of WC_Coupons with coupons that shouldn't cause individual use conflicts.
806
  *
807
- * @param WC_Coupon[] $coupons
 
808
  * @return WC_Coupon[]
809
  */
810
- public function coupon_combination_filter( $coupons ) {
811
 
812
  $filtered_coupons = array();
813
 
814
  //Contains coupon codes that are already in cart or pending in the filtered-array
815
- $applied_coupon_codes = WC()->cart->get_applied_coupons();
 
 
816
 
817
  foreach ( $coupons as $the_coupon ) {
818
  if ( $the_coupon->get_individual_use() && ! in_array( $the_coupon->get_code(), $applied_coupon_codes ) ) {
804
  /**
805
  * Return an array of WC_Coupons with coupons that shouldn't cause individual use conflicts.
806
  *
807
+ * @param WC_Coupon[] $coupons The coupons
808
+ * @param string[] $applied_coupon_codes Coupon codes that are considered to be in the cart. If null WC()->cart->get_applied_coupons() will be used.
809
  * @return WC_Coupon[]
810
  */
811
+ public function coupon_combination_filter( $coupons, $applied_coupon_codes = null ) {
812
 
813
  $filtered_coupons = array();
814
 
815
  //Contains coupon codes that are already in cart or pending in the filtered-array
816
+ if ( $applied_coupon_codes === null ) {
817
+ $applied_coupon_codes = WC()->cart->get_applied_coupons();
818
+ }
819
 
820
  foreach ( $coupons as $the_coupon ) {
821
  if ( $the_coupon->get_individual_use() && ! in_array( $the_coupon->get_code(), $applied_coupon_codes ) ) {
includes/plugins/WJECF_Autocoupon.php CHANGED
@@ -828,6 +828,14 @@ if ( defined( 'ABSPATH' ) && ! class_exists( 'WJECF_Autocoupon' ) ) {
828
  //Array will only have values if option autocoupon_allow_remove == true
829
  $removed_autocoupon_codes = $this->get_option_autocoupon_allow_remove() ? $this->get_removed_autocoupon_codes() : array();
830
 
 
 
 
 
 
 
 
 
831
  $valid_auto_coupons = array();
832
  foreach ( $auto_coupons as $coupon_code => $coupon ) {
833
  if ( isset( $removed_autocoupon_codes[ $coupon_code ] ) ) {
@@ -843,7 +851,7 @@ if ( defined( 'ABSPATH' ) && ! class_exists( 'WJECF_Autocoupon' ) ) {
843
  $valid_auto_coupons[] = $coupon;
844
  }
845
 
846
- return WJECF()->coupon_combination_filter( $valid_auto_coupons );
847
  }
848
 
849
  /**
828
  //Array will only have values if option autocoupon_allow_remove == true
829
  $removed_autocoupon_codes = $this->get_option_autocoupon_allow_remove() ? $this->get_removed_autocoupon_codes() : array();
830
 
831
+ $applied_coupon_codes = WC()->cart->get_applied_coupons();
832
+ $applied_coupon_codes_not_auto = array();
833
+ foreach( $applied_coupon_codes as $coupon_code ) {
834
+ if ( ! $this->is_auto_coupon( $coupon_code ) ) {
835
+ $applied_coupon_codes_not_auto[] = $coupon_code;
836
+ }
837
+ }
838
+
839
  $valid_auto_coupons = array();
840
  foreach ( $auto_coupons as $coupon_code => $coupon ) {
841
  if ( isset( $removed_autocoupon_codes[ $coupon_code ] ) ) {
851
  $valid_auto_coupons[] = $coupon;
852
  }
853
 
854
+ return WJECF()->coupon_combination_filter( $valid_auto_coupons, $applied_coupon_codes_not_auto );
855
  }
856
 
857
  /**
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Extended Coupon Features FREE ===
2
  Contributors: josk79
3
  Tags: woocommerce, coupons, discount
4
- Requires at least: 4.8
5
- Requires PHP: 5.4
6
- Tested up to: 5.2.0
7
- Stable tag: 3.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,6 +101,15 @@ On the settings page (Settings > WooCommerce Extended Coupon Features) check the
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
 
 
 
 
104
  = 3.1.0 =
105
  *Release Date - 2019-05-21*
106
  * TWEAK: Remove domainname from redirect url after using ?apply_coupon=
1
  === WooCommerce Extended Coupon Features FREE ===
2
  Contributors: josk79
3
  Tags: woocommerce, coupons, discount
4
+ Requires at least: 4.9
5
+ Requires PHP: 5.6
6
+ Tested up to: 5.2.3
7
+ Stable tag: 3.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
101
 
102
  == Changelog ==
103
 
104
+ = 3.1.2 =
105
+ *Release Date - 2019-09-18*
106
+ * (PRO) FEATURE: Filter wjecf_is_first_purchase
107
+
108
+ = 3.1.1 =
109
+ *Release Date - 2019-08-13*
110
+ * FIX: Auto coupon priority issue when cart content changes and another 'individual use'-coupon takes precedence
111
+ * (PRO) FIX: Free products: Only set cart item quantity when it has changed (fixes issue with woo-paypalplus which clears session at quantity change)
112
+
113
  = 3.1.0 =
114
  *Release Date - 2019-05-21*
115
  * TWEAK: Remove domainname from redirect url after using ?apply_coupon=
woocommerce-jos-autocoupon.php CHANGED
@@ -3,12 +3,12 @@
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.1.0
7
  * Text Domain: woocommerce-jos-autocoupon
8
  * Author: Soft79
9
  * License: GPL2
10
  * WC requires at least: 3.0.0
11
- * WC tested up to: 3.6.3
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
@@ -16,10 +16,10 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  }
17
 
18
  if ( ! defined( 'WJECF_VERSION' ) ) {
19
- define( 'WJECF_VERSION', '3.1.0' );
20
  }
21
 
22
- // NOTE: This file must be compatible with old PHP versions. All other files can be PHP 5.4+ .
23
  if ( ! function_exists( 'wjecf_load_plugin_textdomain' ) ) {
24
  // We must define wjecf_load_plugin_textdomain() so that versions prior to 3.0 detect this plugin instance.
25
  function wjecf_load_plugin_textdomain() {
@@ -41,7 +41,7 @@ if ( ! function_exists( 'wjecf_load_plugin_textdomain' ) ) {
41
  $requirements = array(
42
  array(
43
  'program' => 'PHP',
44
- 'required_version' => '5.4',
45
  'current_version' => phpversion(),
46
  ),
47
  array(
@@ -51,7 +51,7 @@ if ( ! function_exists( 'wjecf_load_plugin_textdomain' ) ) {
51
  ),
52
  array(
53
  'program' => 'WordPress',
54
- 'required_version' => '4.8',
55
  'current_version' => $GLOBALS['wp_version'],
56
  ),
57
  );
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.1.2
7
  * Text Domain: woocommerce-jos-autocoupon
8
  * Author: Soft79
9
  * License: GPL2
10
  * WC requires at least: 3.0.0
11
+ * WC tested up to: 3.7.0
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
16
  }
17
 
18
  if ( ! defined( 'WJECF_VERSION' ) ) {
19
+ define( 'WJECF_VERSION', '3.1.2' );
20
  }
21
 
22
+ // NOTE: This file must be compatible with old PHP versions. All other files can be PHP 5.6+ .
23
  if ( ! function_exists( 'wjecf_load_plugin_textdomain' ) ) {
24
  // We must define wjecf_load_plugin_textdomain() so that versions prior to 3.0 detect this plugin instance.
25
  function wjecf_load_plugin_textdomain() {
41
  $requirements = array(
42
  array(
43
  'program' => 'PHP',
44
+ 'required_version' => '5.6',
45
  'current_version' => phpversion(),
46
  ),
47
  array(
51
  ),
52
  array(
53
  'program' => 'WordPress',
54
+ 'required_version' => '4.9',
55
  'current_version' => $GLOBALS['wp_version'],
56
  ),
57
  );