WooCommerce Extended Coupon Features - Version 2.6.2

Version Description

  • FEATURE: Auto-coupon compatibility with the 'WooCommerce Free Gift Coupons'-plugin
  • FIX: CATEGORIES AND in combination with variable products
  • FIX: Call to undefined function wc_add_notice()
  • FIX: (PRO) First order purchase: Ignore cancelled/waiting for payment order statuses
  • FIX: (PRO) Auto updater plugins_api return $def instead of false
Download this release

Release Info

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

Code changes from version 2.6.1.1 to 2.6.2

includes/WJECF_AutoCoupon.php CHANGED
@@ -17,7 +17,8 @@ class WJECF_AutoCoupon extends Abstract_WJECF_Plugin {
17
  }
18
 
19
  public function init_hook() {
20
- if ( ! class_exists('WC_Coupon') ) {
 
21
  return;
22
  }
23
 
@@ -596,9 +597,13 @@ class WJECF_AutoCoupon extends Abstract_WJECF_Plugin {
596
 
597
  $has_a_value = false;
598
 
599
- if ( WJECF_Wrap( $coupon )->get_free_shipping() ) {
600
  $has_a_value = true;
601
- } else {
 
 
 
 
602
  //Test whether discount > 0
603
  //See WooCommerce: class-wc-cart.php function get_discounted_price
604
  global $woocommerce;
@@ -611,7 +616,6 @@ class WJECF_AutoCoupon extends Abstract_WJECF_Plugin {
611
  }
612
 
613
  return apply_filters( 'wjecf_coupon_has_a_value', $has_a_value, $coupon );
614
-
615
  }
616
 
617
 
@@ -721,4 +725,4 @@ class WJECF_AutoCoupon extends Abstract_WJECF_Plugin {
721
  return $prio_a > $prio_b ? -1 : 1; //By prio DESC
722
  }
723
  }
724
- }
17
  }
18
 
19
  public function init_hook() {
20
+ //Since 2.6.2 check for frontend request. Prevents 'Call to undefined function wc_add_notice()'.
21
+ if ( ! class_exists('WC_Coupon') || ! WJECF()->is_request( 'frontend' ) ) {
22
  return;
23
  }
24
 
597
 
598
  $has_a_value = false;
599
 
600
+ if ( $coupon->is_type('free_gift') ) { // 'WooCommerce Free Gift Coupons'-plugin
601
  $has_a_value = true;
602
+ }
603
+ elseif ( WJECF_Wrap( $coupon )->get_free_shipping() ) {
604
+ $has_a_value = true;
605
+ }
606
+ else {
607
  //Test whether discount > 0
608
  //See WooCommerce: class-wc-cart.php function get_discounted_price
609
  global $woocommerce;
616
  }
617
 
618
  return apply_filters( 'wjecf_coupon_has_a_value', $has_a_value, $coupon );
 
619
  }
620
 
621
 
725
  return $prio_a > $prio_b ? -1 : 1; //By prio DESC
726
  }
727
  }
728
+ }
includes/WJECF_Controller.php CHANGED
@@ -352,7 +352,9 @@ class WJECF_Controller {
352
  foreach( $items as $item_key => $item ) {
353
  if ( $item->product === false ) continue;
354
 
355
- $product_cats = array_merge ( $product_cats, wp_get_post_terms( WJECF_Wrap( $item->product )->get_id(), 'product_cat', array( "fields" => "ids" ) ) );
 
 
356
  }
357
  //Filter used by WJECF_WPML hook
358
  $product_cats = apply_filters( 'wjecf_get_product_cat_ids', $product_cats );
@@ -795,7 +797,26 @@ class WJECF_Controller {
795
  WC()->session->set( '_wjecf_session_data', $this->_session_data );
796
  }
797
 
798
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
  /**
800
  * Get overwritable template filename
801
  *
352
  foreach( $items as $item_key => $item ) {
353
  if ( $item->product === false ) continue;
354
 
355
+ $product_id = WJECF_Wrap( $item->product )->get_id();
356
+ if ('product_variation' == get_post_type( $product_id )) $product_id = WJECF_Wrap( $item->product )->get_variable_product_id();
357
+ $product_cats = array_merge( $product_cats, wp_get_post_terms( $product_id, 'product_cat', array( "fields" => "ids" ) ) );
358
  }
359
  //Filter used by WJECF_WPML hook
360
  $product_cats = apply_filters( 'wjecf_get_product_cat_ids', $product_cats );
797
  WC()->session->set( '_wjecf_session_data', $this->_session_data );
798
  }
799
 
800
+ /**
801
+ * (Copied from class-woocommerce.php) What type of request is this?
802
+ *
803
+ * @since 2.6.2
804
+ * @param string $type admin, ajax, cron or frontend.
805
+ * @return bool
806
+ */
807
+ public function is_request( $type ) {
808
+ switch ( $type ) {
809
+ case 'admin':
810
+ return is_admin();
811
+ case 'ajax':
812
+ return defined( 'DOING_AJAX' );
813
+ case 'cron':
814
+ return defined( 'DOING_CRON' );
815
+ case 'frontend':
816
+ return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
817
+ }
818
+ }
819
+
820
  /**
821
  * Get overwritable template filename
822
  *
includes/WJECF_WC.php CHANGED
@@ -259,7 +259,7 @@ class WJECF_WC {
259
  }
260
 
261
  /**
262
- * Get attibutes/data for an individual variation from the database and maintain it's integrity.
263
  * @since 2.5.1
264
  * @param int $variation_id
265
  * @return array
259
  }
260
 
261
  /**
262
+ * Get attibutes/data for an individual variation from the database and maintain its integrity.
263
  * @since 2.5.1
264
  * @param int $variation_id
265
  * @return array
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQ
4
  Tags: woocommerce, coupons, discount
5
  Requires at least: 4.7
6
  Requires PHP: 5.3
7
- Tested up to: 4.9.2
8
- Stable tag: 2.6.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -16,11 +16,11 @@ Additional functionality for WooCommerce Coupons: Allow discounts to be automati
16
  "WooCommerce Extended Coupon Features" adds functionality to the WooCommerce coupons and allows for automatic discount rules.
17
  Very easy to use, the functionality is conveniently integrated to the WooCommerce Edit Coupon panel.
18
 
19
- Compatible with WooCommerce 3.3.0. Backwards compatible with older WooCommerce versions (2.6.0 confirmed).
20
 
21
  Full documentation is available at [www.soft79.nl](http://www.soft79.nl/documentation/wjecf).
22
 
23
- * *Auto coupons*: Allow coupons to be automatically added to the users cart if it's restrictions are met,
24
  * Apply coupon via an url,
25
  * Restrict coupon by shipping method,
26
  * Restrict coupon by payment method,
@@ -90,8 +90,8 @@ Paste this snippet in your theme's functions.php:
90
  `
91
  //Update the cart preview when the billing email is changed by the customer
92
  add_filter( 'woocommerce_checkout_fields', function( $checkout_fields ) {
93
- $checkout_fields['billing']['billing_email']['class'][] = 'update_totals_on_change';
94
- return $checkout_fields;
95
  } );
96
  `
97
 
@@ -109,6 +109,9 @@ Sure! [This](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQ
109
  == Changelog ==
110
 
111
  = 2.6.2 =
 
 
 
112
  * FIX: (PRO) First order purchase: Ignore cancelled/waiting for payment order statuses
113
  * FIX: (PRO) Auto updater plugins_api return $def instead of false
114
 
@@ -358,7 +361,7 @@ Sure! [This](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQ
358
  = 2.0.0 =
359
  * RENAME: Renamed plugin from "WooCommerce auto added coupons" to "WooCommerce Extended Coupon Features"
360
  * FEATURE: Restrict coupons by payment method
361
- * FEATURE: Restrict coupons by shipping method
362
  * FEATURE: Use AND-operator for the selected products (default is OR)
363
  * FIX: Validate email restrictions for auto coupons
364
  * Norwegian translation added (Thanks to Anders Zorensen)
@@ -372,7 +375,7 @@ Sure! [This](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQ
372
  * Included translations: Dutch, German, Spanish (Thanks to stephan.sperling for the german translation)
373
 
374
  = 1.1.3.1 =
375
- * FIX: Apply auto coupon if discount is 0.00 and free shipping is ticked
376
 
377
  = 1.1.3 =
378
  * Don't apply coupon if the discount is 0.00
4
  Tags: woocommerce, coupons, discount
5
  Requires at least: 4.7
6
  Requires PHP: 5.3
7
+ Tested up to: 4.9.4
8
+ Stable tag: 2.6.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
16
  "WooCommerce Extended Coupon Features" adds functionality to the WooCommerce coupons and allows for automatic discount rules.
17
  Very easy to use, the functionality is conveniently integrated to the WooCommerce Edit Coupon panel.
18
 
19
+ Compatible with WooCommerce 3.3.4. Backwards compatible with older WooCommerce versions (2.6.0 confirmed).
20
 
21
  Full documentation is available at [www.soft79.nl](http://www.soft79.nl/documentation/wjecf).
22
 
23
+ * *Auto coupons*: Allow coupons to be automatically added to the users cart if its restrictions are met,
24
  * Apply coupon via an url,
25
  * Restrict coupon by shipping method,
26
  * Restrict coupon by payment method,
90
  `
91
  //Update the cart preview when the billing email is changed by the customer
92
  add_filter( 'woocommerce_checkout_fields', function( $checkout_fields ) {
93
+ $checkout_fields['billing']['billing_email']['class'][] = 'update_totals_on_change';
94
+ return $checkout_fields;
95
  } );
96
  `
97
 
109
  == Changelog ==
110
 
111
  = 2.6.2 =
112
+ * FEATURE: Auto-coupon compatibility with the 'WooCommerce Free Gift Coupons'-plugin
113
+ * FIX: CATEGORIES AND in combination with variable products
114
+ * FIX: Call to undefined function wc_add_notice()
115
  * FIX: (PRO) First order purchase: Ignore cancelled/waiting for payment order statuses
116
  * FIX: (PRO) Auto updater plugins_api return $def instead of false
117
 
361
  = 2.0.0 =
362
  * RENAME: Renamed plugin from "WooCommerce auto added coupons" to "WooCommerce Extended Coupon Features"
363
  * FEATURE: Restrict coupons by payment method
364
+ * FEATURE: Restrict coupons by shipping method
365
  * FEATURE: Use AND-operator for the selected products (default is OR)
366
  * FIX: Validate email restrictions for auto coupons
367
  * Norwegian translation added (Thanks to Anders Zorensen)
375
  * Included translations: Dutch, German, Spanish (Thanks to stephan.sperling for the german translation)
376
 
377
  = 1.1.3.1 =
378
+ * FIX: Apply auto coupon if discount is 0.00 and free shipping is ticked
379
 
380
  = 1.1.3 =
381
  * Don't apply coupon if the discount is 0.00
woocommerce-jos-autocoupon.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: WooCommerce Extended Coupon Features
4
  * Plugin URI: http://www.soft79.nl
5
  * Description: Additional functionality for WooCommerce Coupons: Apply certain coupons automatically, allow applying coupons via an url, etc...
6
- * Version: 2.6.1.1
7
  * Author: Soft79
8
  * License: GPL2
9
  * WC requires at least: 2.6.0
10
- * WC tested up to: 3.3.0
11
  */
12
 
13
- if ( ! defined('WJECF_VERSION') ) define ('WJECF_VERSION', '2.6.1.1');
14
 
15
  // Changelog: see readme.txt
16
 
3
  * Plugin Name: WooCommerce Extended Coupon Features
4
  * Plugin URI: http://www.soft79.nl
5
  * Description: Additional functionality for WooCommerce Coupons: Apply certain coupons automatically, allow applying coupons via an url, etc...
6
+ * Version: 2.6.2
7
  * Author: Soft79
8
  * License: GPL2
9
  * WC requires at least: 2.6.0
10
+ * WC tested up to: 3.3.4
11
  */
12
 
13
+ if ( ! defined('WJECF_VERSION') ) define ('WJECF_VERSION', '2.6.2');
14
 
15
  // Changelog: see readme.txt
16