WooCommerce Extended Coupon Features - Version 1.1.0

Version Description

  • Allow applying coupon via an url using ?apply_coupon=coupon_code
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.1.0

Files changed (3) hide show
  1. assets/Thumbs.db +0 -0
  2. readme.txt +22 -6
  3. woocommerce-jos-autocoupon.php +18 -4
assets/Thumbs.db DELETED
Binary file
readme.txt CHANGED
@@ -3,12 +3,13 @@ Contributors: josk79
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQBCS2QHRY&lc=NL&item_name=Jos%20Koenis&item_number=wordpress%2dplugin&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: woocommerce, coupons, discount
5
  Requires at least: 3.0.1
6
- Tested up to: 3.9.1
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Allow discounts to be automatically added to the WooCommerce cart when it's restrictions are met. Coupons code will not be presented to the user.
 
12
 
13
  == Description ==
14
 
@@ -19,7 +20,9 @@ The discount will be presented to the user by a descriptive text. No coupon code
19
 
20
  No programming required.
21
 
22
- **Example**: Want to have a discount of $ 5.00 when the cart reaches $ 50.00 ?
 
 
23
 
24
  1. Create a coupon, let's name it *auto_50bucks* and enter a short description e.g. *$ 50.00 order discount*
25
  2. On the General tab: Select discount type *Cart discount*, and set the coupon amount to $ 5.00
@@ -27,7 +30,13 @@ No programming required.
27
 
28
  Voila! The discount will be applied when the customer reaches $ 50.00.
29
 
30
- This plugin has been tested with WordPress 3.9.1 and WooCommerce 2.1.11 and 2.1.12. Also in combination with WPML.
 
 
 
 
 
 
31
 
32
  == Installation ==
33
 
@@ -47,9 +56,13 @@ This plugin has been tested with WordPress 3.9.1 and WooCommerce 2.1.11 and 2.1.
47
 
48
  Yes, all frontend string values are translatable with WPML. Translatable items appear in the context `woocommerce-jos-autocoupon` in "String Translations".
49
 
 
 
 
 
50
  = Can I make a donation? =
51
 
52
- Sure! [This](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQBCS2QHRY&lc=NL&item_name=Jos%20Koenis&item_number=wordpress%2dplugin&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) is the link.
53
 
54
  == Screenshots ==
55
 
@@ -57,6 +70,9 @@ Sure! [This](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQ
57
 
58
  == Changelog ==
59
 
 
 
 
60
  = 1.0.1 =
61
  * Don't add the coupon if *Individual use only* is checked and another coupon is already applied.
62
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQBCS2QHRY&lc=NL&item_name=Jos%20Koenis&item_number=wordpress%2dplugin&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: woocommerce, coupons, discount
5
  Requires at least: 3.0.1
6
+ Tested up to: 3.9.2
7
+ Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Allow applying coupons through an url.
12
+ Allow discounts to be automatically added to the WooCommerce cart when it's restrictions are met.
13
 
14
  == Description ==
15
 
20
 
21
  No programming required.
22
 
23
+ Since version 1.1.0 it's also possible to apply coupons to the cart via an url.
24
+
25
+ **Example**: Let the customer have a discount of $ 5.00 when the cart reaches $ 50.00.
26
 
27
  1. Create a coupon, let's name it *auto_50bucks* and enter a short description e.g. *$ 50.00 order discount*
28
  2. On the General tab: Select discount type *Cart discount*, and set the coupon amount to $ 5.00
30
 
31
  Voila! The discount will be applied when the customer reaches $ 50.00.
32
 
33
+ **Example**: Apply coupon through an url.
34
+
35
+ 1. Use the url www.example.com/url-to-shop?apply_coupon=my_coupon
36
+
37
+ Voila! Any coupon can be applied this way.
38
+
39
+ This plugin has been tested with WordPress 3.9.2 and WooCommerce 2.1.11 and 2.1.12. Also in combination with WPML.
40
 
41
  == Installation ==
42
 
56
 
57
  Yes, all frontend string values are translatable with WPML. Translatable items appear in the context `woocommerce-jos-autocoupon` in "String Translations".
58
 
59
+ = Why isn't my coupon applied using www.example.com?apply_coupon=my_coupon ? =
60
+
61
+ The coupon will only be applied if the url links to a WooCommerce page (e.g. product loop / cart / product detail ).
62
+
63
  = Can I make a donation? =
64
 
65
+ Sure! [This](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5T9XQBCS2QHRY&lc=NL&item_name=Jos%20Koenis&item_number=wordpress%2dplugin&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) is the link. Greatly appreciated!
66
 
67
  == Screenshots ==
68
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.1.0 =
74
+ * Allow applying coupon via an url using *?apply_coupon=coupon_code*
75
+
76
  = 1.0.1 =
77
  * Don't add the coupon if *Individual use only* is checked and another coupon is already applied.
78
 
woocommerce-jos-autocoupon.php CHANGED
@@ -2,16 +2,19 @@
2
  /**
3
  * Plugin Name: WooCommerce auto added coupons
4
  * Plugin URI: http://wordpress.org/plugins/woocommerce-auto-added-coupons
5
- * Description: Automatically add certain coupons to the cart if it's conditions are met.
6
- * Version: 1.0.1
7
  * Author: Jos Koenis
8
  * License: GPL2
9
  */
10
 
11
  /*
12
  Change history:
 
 
13
  1.0.1:
14
  - Don't apply an autocoupon if the coupon is for individual_use and another coupon is already applied.
 
15
 
16
  */
17
 
@@ -40,8 +43,9 @@ class WC_Jos_AutoCoupon_Controller{
40
  add_action( 'woocommerce_check_cart_items', array( &$this, 'update_matched_autocoupons' ) , 0 ); //Remove coupon before WC does it and shows a message
41
  add_filter('woocommerce_cart_totals_coupon_label', array( &$this, 'coupon_label' ), 10, 2 );
42
  add_filter('woocommerce_cart_totals_coupon_html', array( &$this, 'coupon_html' ), 10, 2 );
43
- // 'woocommerce_before_cart'
44
- // 'woocommerce_checkout_init'
 
45
  }
46
 
47
  /* ADMIN HOOKS */
@@ -60,6 +64,16 @@ class WC_Jos_AutoCoupon_Controller{
60
  }
61
 
62
  /* FRONTEND HOOKS */
 
 
 
 
 
 
 
 
 
 
63
 
64
  /**
65
  * Overwrite the html created by wc_cart_totals_coupon_label() so a descriptive text will be shown for the discount.
2
  /**
3
  * Plugin Name: WooCommerce auto added coupons
4
  * Plugin URI: http://wordpress.org/plugins/woocommerce-auto-added-coupons
5
+ * Description: Allow discounts to be automatically added to the cart when it's restrictions are met. Allow applying coupons via an url.
6
+ * Version: 1.1.0
7
  * Author: Jos Koenis
8
  * License: GPL2
9
  */
10
 
11
  /*
12
  Change history:
13
+ 1.1.0:
14
+ - Allow applying coupon via an url using *?apply_coupon=coupon_code*
15
  1.0.1:
16
  - Don't apply an autocoupon if the coupon is for individual_use and another coupon is already applied.
17
+
18
 
19
  */
20
 
43
  add_action( 'woocommerce_check_cart_items', array( &$this, 'update_matched_autocoupons' ) , 0 ); //Remove coupon before WC does it and shows a message
44
  add_filter('woocommerce_cart_totals_coupon_label', array( &$this, 'coupon_label' ), 10, 2 );
45
  add_filter('woocommerce_cart_totals_coupon_html', array( &$this, 'coupon_html' ), 10, 2 );
46
+
47
+ add_action( 'wp_loaded', array( &$this, 'coupon_by_url' )); //Coupon through url
48
+
49
  }
50
 
51
  /* ADMIN HOOKS */
64
  }
65
 
66
  /* FRONTEND HOOKS */
67
+
68
+ /**
69
+ * Add coupon through url
70
+ */
71
+ public function coupon_by_url() {
72
+ if (isset($_GET['apply_coupon'])) {
73
+ global $woocommerce;
74
+ $woocommerce->cart->add_discount( $_GET['apply_coupon'] );
75
+ }
76
+ }
77
 
78
  /**
79
  * Overwrite the html created by wc_cart_totals_coupon_label() so a descriptive text will be shown for the discount.