WooCommerce Extended Coupon Features - Version 3.1.4

Version Description

Release Date - 2020-03-28 * (PRO) FEATURE: Restrict coupon by shipping zone

Download this release

Release Info

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

Code changes from version 3.1.2 to 3.1.4

includes/class-wjecf-controller.php CHANGED
@@ -17,6 +17,7 @@ class WJECF_Controller {
17
  const E_WC_COUPON_PAYMENT_METHOD_NOT_MET = 79105;
18
  const E_WC_COUPON_NOT_FOR_THIS_USER = 79106;
19
  const E_WC_COUPON_FIRST_PURCHASE_ONLY = 79107;
 
20
 
21
  private $options = null;
22
  private $_user_emails = null;
@@ -252,6 +253,10 @@ class WJECF_Controller {
252
  $this->validate_payment_method( $coupon );
253
  $this->validate_customer( $coupon );
254
 
 
 
 
 
255
  //We use our own filter (instead of woocommerce_coupon_is_valid) for easier compatibility management
256
  //e.g. WC prior to 2.3.0 can't handle Exceptions; while 2.3.0 and above require exceptions
257
  do_action( 'wjecf_assert_coupon_is_valid', $coupon, $wc_discounts );
@@ -450,8 +455,7 @@ class WJECF_Controller {
450
  $shipping_method_ids = $this->get_coupon_shipping_method_ids( $coupon );
451
  if ( sizeof( $shipping_method_ids ) > 0 ) {
452
  $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
453
- $chosen_shipping = empty( $chosen_shipping_methods ) ? '' : $chosen_shipping_methods[0];
454
- //$this->log('debug', 'Current shipping method: ' . ( $chosen_shipping === '' ? 'none' : $chosen_shipping ));
455
  $chosen_shipping = explode( ':', $chosen_shipping ); //UPS and USPS stores extra data, seperated by colon
456
  $chosen_shipping = $chosen_shipping[0];
457
 
17
  const E_WC_COUPON_PAYMENT_METHOD_NOT_MET = 79105;
18
  const E_WC_COUPON_NOT_FOR_THIS_USER = 79106;
19
  const E_WC_COUPON_FIRST_PURCHASE_ONLY = 79107;
20
+ const E_WC_COUPON_SHIPPING_ZONE_NOT_MET = 79108;
21
 
22
  private $options = null;
23
  private $_user_emails = null;
253
  $this->validate_payment_method( $coupon );
254
  $this->validate_customer( $coupon );
255
 
256
+ if ( $this->is_pro() ) {
257
+ $this->validate_pro( $coupon, $wc_discounts );
258
+ }
259
+
260
  //We use our own filter (instead of woocommerce_coupon_is_valid) for easier compatibility management
261
  //e.g. WC prior to 2.3.0 can't handle Exceptions; while 2.3.0 and above require exceptions
262
  do_action( 'wjecf_assert_coupon_is_valid', $coupon, $wc_discounts );
455
  $shipping_method_ids = $this->get_coupon_shipping_method_ids( $coupon );
456
  if ( sizeof( $shipping_method_ids ) > 0 ) {
457
  $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
458
+ $chosen_shipping = empty( $chosen_shipping_methods ) ? '' : $chosen_shipping_methods[0];
 
459
  $chosen_shipping = explode( ':', $chosen_shipping ); //UPS and USPS stores extra data, seperated by colon
460
  $chosen_shipping = $chosen_shipping[0];
461
 
includes/plugins/WJECF_Admin.php CHANGED
@@ -285,6 +285,10 @@ if ( defined( 'ABSPATH' ) && ! class_exists( 'WJECF_Admin' ) ) {
285
  </p>
286
  <?php
287
 
 
 
 
 
288
  //=============================
289
  // Payment methods
290
  ?>
285
  </p>
286
  <?php
287
 
288
+ if ( WJECF()->is_pro() ) {
289
+ WJECF()->render_admin_shipping_zones( $thepostid );
290
+ }
291
+
292
  //=============================
293
  // Payment methods
294
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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
 
@@ -17,10 +17,10 @@ Very easy to use, the functionality is conveniently integrated to the WooCommerc
17
 
18
  Requires:
19
  * WooCommerce 3.0 or newer (3.4+ recommended)
20
- * PHP 5.4 or newer (7.2+ Recommended)
21
  * WordPress 4.9 or newer
22
 
23
- For compatibility with older versions of WooCommerce, please use "WooCommerce Extended Coupon Features" version 2.6.4.
24
 
25
  Full documentation is available at [www.soft79.nl](http://www.soft79.nl/documentation/wjecf).
26
 
@@ -33,6 +33,8 @@ Full documentation is available at [www.soft79.nl](http://www.soft79.nl/document
33
  * (PRO) Add *free products* to the customer's cart based on coupon rules
34
  * (PRO) Allow a cart discount to be applied based on quantity / subtotal of matching products
35
  * (PRO) Set Auto Coupon priorities (Useful for 'Individual Use Only'-coupons)
 
 
36
  * (PRO) API to allow developers to use functions of this plugin
37
 
38
  For more information or the PRO version please visit [www.soft79.nl](http://www.soft79.nl)
@@ -58,7 +60,7 @@ Apply coupon through an url like this:
58
  Voila! Any coupon can be applied this way. Please note that an empty cart can not contain any coupons. Download the free [Cart Links for WooCommerce-plugin](https://www.soft79.nl/product/cart-links-for-woocommerce/) to handle the 'fill_cart'-part of the url.
59
 
60
 
61
- This plugin has been tested in combination with WPML and [WP-Multilang](https://wordpress.org/plugins/wp-multilang/).
62
 
63
  == Installation ==
64
 
@@ -101,6 +103,14 @@ On the settings page (Settings > WooCommerce Extended Coupon Features) check the
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
 
 
 
104
  = 3.1.2 =
105
  *Release Date - 2019-09-18*
106
  * (PRO) FEATURE: Filter wjecf_is_first_purchase
3
  Tags: woocommerce, coupons, discount
4
  Requires at least: 4.9
5
  Requires PHP: 5.6
6
+ Tested up to: 5.3.2
7
+ Stable tag: 3.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
17
 
18
  Requires:
19
  * WooCommerce 3.0 or newer (3.4+ recommended)
20
+ * PHP 5.6 or newer (7.2+ Recommended)
21
  * WordPress 4.9 or newer
22
 
23
+ For compatibility with older versions of WooCommerce, please use "WooCommerce Extended Coupon Features" version 2.6.5.
24
 
25
  Full documentation is available at [www.soft79.nl](http://www.soft79.nl/documentation/wjecf).
26
 
33
  * (PRO) Add *free products* to the customer's cart based on coupon rules
34
  * (PRO) Allow a cart discount to be applied based on quantity / subtotal of matching products
35
  * (PRO) Set Auto Coupon priorities (Useful for 'Individual Use Only'-coupons)
36
+ * (PRO) Restrict coupon by shipping zone
37
+ * (PRO) Allow coupon for first purchase only
38
  * (PRO) API to allow developers to use functions of this plugin
39
 
40
  For more information or the PRO version please visit [www.soft79.nl](http://www.soft79.nl)
60
  Voila! Any coupon can be applied this way. Please note that an empty cart can not contain any coupons. Download the free [Cart Links for WooCommerce-plugin](https://www.soft79.nl/product/cart-links-for-woocommerce/) to handle the 'fill_cart'-part of the url.
61
 
62
 
63
+ This plugin has been tested in combination with [WP-Multilang](https://wordpress.org/plugins/wp-multilang/).
64
 
65
  == Installation ==
66
 
103
 
104
  == Changelog ==
105
 
106
+ = 3.1.4 =
107
+ *Release Date - 2020-03-28*
108
+ * (PRO) FEATURE: Restrict coupon by shipping zone
109
+
110
+ = 3.1.3 =
111
+ *Release Date - 2019-11-25*
112
+ * (PRO) FIX: Custom meta allow number or boolean (yes | no) values
113
+
114
  = 3.1.2 =
115
  *Release Date - 2019-09-18*
116
  * (PRO) FEATURE: Filter wjecf_is_first_purchase
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.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,7 +16,7 @@ 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+ .
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.4
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: 4.0.1
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
16
  }
17
 
18
  if ( ! defined( 'WJECF_VERSION' ) ) {
19
+ define( 'WJECF_VERSION', '3.1.4-dev.1' );
20
  }
21
 
22
  // NOTE: This file must be compatible with old PHP versions. All other files can be PHP 5.6+ .