Commit Graph

71 Commits

Author SHA1 Message Date
George Stephanis a17addae0a Migrate the actual querying of the underlying data structure.
Move it into the relative class for tidiness, and have it be called via
an access function.
2015-08-24 14:30:13 -04:00
George Stephanis 4692afacdd Add a conditional to match `inc_usage_count()`
Otherwise, for empty $used_by values, it will fire off a needless db
query.
2015-08-24 14:20:30 -04:00
George Stephanis 40dfb59bde Clarify a comment as to why we're not using a core method. 2015-08-24 14:19:08 -04:00
George Stephanis fd3ceb3e04 Allow a user to be specified for validating the limit of. 2015-08-24 13:08:44 -04:00
George Stephanis e6b7d5c49a Simplify the data we're working with.
This provides slightly safer bounds for large data sets.
2015-08-24 13:08:23 -04:00
Mike Jolley d222dd4c37 Don't apply product discount if price is already 0
Closes #8725
2015-08-05 13:45:32 +01:00
Claudio Sanches 9e41552342 Removed all "@return void" 2015-07-16 16:55:48 -03:00
Mike Jolley d1db647c05 Fix validate_sale_items logic for variable products
Closes #8591
2015-07-16 17:53:52 +01:00
Mike Jolley a148e867b0 [2.3] Fix sale item exclusion logic for variations
Closes #8324
2015-06-09 16:10:46 +01:00
Mike Jolley f1af777368 [2.3] Fix typo in validate_maximum_amount
Closes #8207
2015-05-26 17:40:07 +01:00
Nikki DelRosso 940c2369b0 Added method to check if cart is empty 2015-05-14 14:18:53 -07:00
Mike Jolley af6998fe4d [2.3] Correct coupon % calc. Added inline note to prevent regression.
Closes #8074
2015-05-05 14:33:35 +01:00
Mike Jolley c8467b143a [2.3] Use exclusive price and exclusive subtotal to work out % of discount 2015-04-17 20:42:18 +01:00
Mike Jolley 809573af41 [2.3] Coupon product id and category id checks should run for all coupon types
Closes #7936
2015-04-14 10:21:52 +01:00
Mike Jolley 2ddd07b252 FIx fixed product discount 2015-04-10 10:55:40 +01:00
Mike Jolley 68194bf0ed Round discount totals 2015-04-10 10:28:46 +01:00
Caleb Burks 3728f8b001 Enhanced Error Message
As pointed out by jnachtigall (https://github.com/woothemes/woocommerce/issues/7870), this could help customers who may have accidentally mis-typed the coupon.
2015-04-01 16:56:10 -07:00
Mike Jolley 65bc9db763 Tweak get_coupon() method
Closes #7830
2015-03-27 15:36:53 +00:00
Mike Jolley f23f1bbd27 format values to prevent issues due to floats
Closes #7822
2015-03-27 15:15:00 +00:00
Mike Jolley 457050ae9d Improved coupon percent calculation for fixed discounts.
Closes #7669
2015-03-09 17:05:09 +00:00
justinstern 809f4be1a3 get_coupon_error vs get_coupon_message 2015-03-06 11:36:34 -05:00
justinstern 9f3ae48b8f Skip coupon notices if there's no message
Handy for defining programmatic coupons to apply cart discounts, when
you wouldn't necessarily want to have a notice displayed
2015-03-06 00:36:01 -05:00
Mike Jolley b6e7e4e8ad Improve category coupon message.
Closes #7463
2015-02-18 11:17:58 +00:00
Mike Jolley 62cb430eaa Run coupon codes through html_entity_decode.
Closes #7395
2015-02-12 22:50:22 +00:00
Mike Jolley e99b3a9bf8 limit_usage_to_x_items option in coupons.
Closes #7396
2015-02-12 22:39:40 +00:00
Mike Jolley c71bff2844 Only apply product/cat coupon checks for cart to cart coupons.
Closes #7389
2015-02-12 16:15:28 +00:00
Mike Jolley a54b9c61e2 Define coupon magic props 2015-02-03 14:20:46 +00:00
Claudio Sanches d6023818fd Fixed the increase and decreate of coupons usage count 2015-01-30 12:14:34 -02:00
Mike Jolley 147258d5b8 Fix cart coupon on-sale checks for variations.
Closes #7078
2015-01-13 16:12:54 +00:00
Mike Jolley 549d7ab2c0 Removed 'apply before tax' options for coupons - this should be the default core behaviour 2014-11-24 17:24:25 +00:00
Mike Jolley 537233efcc Split is_valid() into separate methods 2014-11-14 17:18:02 +00:00
Mike Jolley f600c5ec05 Limit coupons to X needs to persist across lines during calc
Fixes #6745
2014-11-14 16:38:33 +00:00
Mike Jolley 1d3b8db754 Move formatting logic 2014-11-14 16:22:01 +00:00
Mike Jolley 668e5ffb5c Some refactoring of the coupon class to load data with less code 2014-11-14 16:22:01 +00:00
Marin Atanasov 5ad973eac2 fixing small typo 2014-11-11 22:52:45 +02:00
Mike Jolley 0bc3ad868d [2.2] Fix error message with maximum amount
Fixes #6567
2014-10-21 14:55:43 +01:00
Mike Jolley 5ff8f65d1f Merge pull request #6507 from chrisnharvey/master
Pass cart item values to is_valid_for_product method in WC_Coupon
2014-10-17 12:09:23 +01:00
Barry Kooij b353c75d43 Display excluded categories in coupon error message.
Related #6400.
2014-10-14 16:18:31 +02:00
Barry Kooij 4371c661ec Codestyle. 2014-10-14 16:11:46 +02:00
Barry Kooij 389eae28c2 Display what products are excluded from using with a coupon.
Fixes #6400.
2014-10-14 16:09:56 +02:00
Chris Harvey 4119e70b3c Setting values to an optional argument 2014-10-13 09:32:40 +01:00
Chris Harvey 00c77d1716 Accept cart item values in is_valid_for_product method and pass these to the woocommerce_coupon_is_valid_for_product filter 2014-10-10 15:45:01 +01:00
shivapoudel 342d3186db Found and fix indendation for multiline comments for class-wc-coupon.php :) 2014-09-21 00:31:22 +05:45
Mike Jolley c4ef86d44e scrutinizer patches 2014-09-08 00:37:55 +01:00
adamawesomeface 0e22412a7d maximum ammount for coupon functionality added 2014-08-08 07:38:58 -04:00
Mike Jolley 0130caec2b indentation 2014-07-30 17:07:35 +01:00
wilgert 0b032ab469 Update class-wc-coupon.php
add middle statement to ternary operator has ommitting this is only supported since PHP 5.3 and WooCommerce requires >5.2.4
2014-07-21 15:59:20 +02:00
wilgert 6ccd084e52 Update class-wc-coupon.php
If you loaded custom coupon data using the  `'woocommerce_get_shop_coupon_data'` filter. Only `$coupon->amount` was set. While the 'normal' coupons loaded from the database get both `$coupon->coupon_amount` and `$coupon->amount` set.

This change also adds `$coupon->coupon_amount` for in code generated coupons and allows functions using the `'woocommerce_get_shop_coupon_data'` filter to use either `amount` or `coupon_amount`.
2014-07-21 15:54:10 +02:00
Mike Jolley 170399e5c3 Filter is_valid_for_product even when not relevant.
#5681
2014-07-04 11:03:12 +01:00
Mike Jolley 0448165c02 woocommerce_coupon_is_valid_for_cart
Closes #5681
2014-07-02 15:03:48 +01:00