Permalink
Browse files

Added more error messages for coupons

  • Loading branch information...
mikejolley committed Aug 31, 2012
1 parent f12a824 commit 8cdbf6b5a4e79e8a0e81dc5b55a26b393c6f685c
Showing with 17 additions and 4 deletions.
  1. +16 −4 classes/class-wc-coupon.php
  2. +1 −0 readme.txt
@@ -239,7 +239,10 @@ function is_valid() {
$valid_for_cart = true;
endif;
endforeach; endif;
- if ( ! $valid_for_cart ) $valid = false;
+ if ( ! $valid_for_cart ) {
+ $valid = false;
+ $error = __( 'Sorry, your cart contents do not qualify for this coupon.', 'woocommerce' );
+ }
endif;
// Category ids - If a product included is found in the cart then its valid
@@ -252,7 +255,10 @@ function is_valid() {
if ( sizeof( array_intersect( $product_cats, $this->product_categories ) ) > 0 ) $valid_for_cart = true;
endforeach; endif;
- if ( ! $valid_for_cart ) $valid = false;
+ if ( ! $valid_for_cart ) {
+ $valid = false;
+ $error = __( 'Sorry, your cart contents do not qualify for this coupon.', 'woocommerce' );
+ }
endif;
// Cart discounts cannot be added if non-eligble product is found in cart
@@ -266,7 +272,10 @@ function is_valid() {
$valid_for_cart = false;
endif;
endforeach; endif;
- if ( ! $valid_for_cart ) $valid = false;
+ if ( ! $valid_for_cart ) {
+ $valid = false;
+ $error = __( 'Sorry, your cart contents do not qualify for this coupon.', 'woocommerce' );
+ }
endif;
// Exclude Categories
@@ -279,7 +288,10 @@ function is_valid() {
if ( sizeof( array_intersect( $product_cats, $this->exclude_product_categories ) ) > 0 ) $valid_for_cart = false;
endforeach; endif;
- if ( ! $valid_for_cart ) $valid = false;
+ if ( ! $valid_for_cart ) {
+ $valid = false;
+ $error = __( 'Sorry, your cart contents do not qualify for this coupon.', 'woocommerce' );
+ }
endif;
endif;
View
@@ -153,6 +153,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
= 1.7 =
* Feature - Added sales by category report
* Tweak - If a PayPal prefix is changed, IPN requests break for all existing orders - fixed. new woocommerce_get_order_id_by_order_key() function added. Thanks Brent.
+* Fix - Added more error messages for coupons.
= 1.6.5.1 - 25/08/2012 =
* Fix - Parse error in Users overview screen

0 comments on commit 8cdbf6b

Please sign in to comment.