Commit Graph

129 Commits

Author SHA1 Message Date
Mike Jolley df35845d4d wc_get_coupon_id_by_code 2016-08-30 11:43:53 +01:00
Mike Jolley b0672a000a Fixed unit tests 2016-08-26 16:44:00 +01:00
Mike Jolley f034e1f69d Exception handling and REST optimisation 2016-08-26 15:42:42 +01:00
Mike Jolley 5c40236d79 Fixes notices 2016-08-26 15:24:01 +01:00
Mike Jolley ed01282340 Made data match schema 2016-08-26 15:20:44 +01:00
Mike Jolley 210763e536 use CRUD in admin 2016-08-26 14:50:17 +01:00
Mike Jolley b4746e28cf Optimise read_manual_coupon 2016-08-26 13:13:50 +01:00
Mike Jolley 69c48db0a8 Correct ids method 2016-08-26 12:53:02 +01:00
Mike Jolley cd81622d15 Read props 2016-08-26 12:52:22 +01:00
Mike Jolley 7405053a6a Add exceptions 2016-08-26 12:33:33 +01:00
Mike Jolley 48243109c0 This is ran on set 2016-08-26 12:23:53 +01:00
Mike Jolley c6d0d059fd Remove typecasts on get 2016-08-26 12:22:05 +01:00
Justin Shreve a243829db6 Convert Coupon Controller to use CRUD operations 2016-08-22 15:06:21 -07:00
Mike Jolley 1bc9da3e91 Merge branch 'master' into WC-CRUD
# Conflicts:
#	includes/class-wc-coupon.php
2016-08-04 12:10:04 +01:00
Claudio Sanches 7778583340 Fixed wrong number of decimal precision, closes #11368 2016-07-11 17:26:54 +02:00
Mike Jolley 48bba78cae Only apply new logic to product coupons 2016-06-27 15:58:08 +01:00
Mike Jolley 01b48e699a Fix exclude_product_ids prop 2016-06-27 15:02:58 +01:00
Mike Jolley 0ed58784fd Fix - add validate_excluded_items function to validate product coupons before applying them 2016-06-27 15:02:32 +01:00
Mike Jolley 8a46831eb1 Made coupon valid check more readable 2016-06-27 14:59:50 +01:00
Mike Jolley 731c134d9e Maximum coupon check should allow the 'maximum' value. 2016-06-18 19:54:02 +01:00
Mike Jolley 78142a8ebb Merge branch 'master' into WC-CRUD
# Conflicts:
#	includes/class-wc-checkout.php
#	includes/class-wc-coupon.php
#	includes/class-wc-customer.php
#	tests/unit-tests/cart/cart.php
#	tests/unit-tests/cart/functions.php
#	tests/unit-tests/coupon/coupon.php
#	woocommerce.php
2016-06-13 15:01:58 +01:00
Mike Jolley a0c01d963b Vars and docs 2016-06-06 18:18:26 +01:00
Mike Jolley e00c3450c5 Discount rounding logic improvements
Instead of rounding the single item discount amount, this rounds the
line to the store DP setting before running tax logic.

Fixes #10963
Also works with #10573

Includes unit tests
2016-05-23 16:56:31 +01:00
Mike Jolley 33d325cd88 Only cache valid coupon codes
Fixes #10950
2016-05-20 10:36:36 +01:00
Mike Jolley a77735432b Use get_displayed_subtotal() to determine if conditions for coupons and free shipping is met.
@claudiosmweb

Closes #10711
2016-04-18 11:39:00 +01:00
Mike Jolley 534cd2a384 Use discount rounding mode when getting discounted price.
#10573 @claudiosmweb
2016-03-23 11:27:36 +00:00
Justin Shreve 7f0e0c8f0c Finish proper integetration with WC_Data's meta methods. 2016-03-17 11:14:15 -07:00
Justin Shreve f65c9305bf Update WC_Coupon to use the new WC_Data class and meta methods. 2016-03-17 09:38:56 -07:00
Justin Shreve 60085e582a Fix some comments/spacing issues. 2016-03-17 09:19:29 -07:00
Justin Shreve f973b9d122 Make some improvements to metadata. Don't return [0] array, allow setting custom meta with a WC_Coupon method. Fix up some tests. 2016-03-17 09:19:29 -07:00
Justin Shreve 7e97ee94c1 Update deprecated and doing it wrong version numbers 2016-03-17 09:19:28 -07:00
Justin Shreve 69973d520e Update version strings 2016-03-17 09:19:28 -07:00
Justin Shreve 5ea607e236 Handle the rest of the PR feedback:
* Run get_code through the woocommerce_coupon_code filter
* Convert expiry dates to timestamps in set_expiry_date
* Simplify product ID array explodes to get an empty array
2016-03-17 09:19:28 -07:00
Justin Shreve 0268a67c4b Address a few of the feedback items from the PR:
* Switch all coupon fields to _data
* Move coupon custom fields to _meta_data
* Shorten the 'yes' -> true checks
* Add a test for getting custom fields
2016-03-17 09:19:28 -07:00
Justin Shreve 61ae531de0 Add hooks for create, update, and delete. 2016-03-17 09:19:28 -07:00
Justin Shreve 50e1bc7117 Add tests for the getter/setter methods 2016-03-17 09:19:28 -07:00
Justin Shreve 7a0c8d146b Add the ability to create coupons via code (so things like Points & Rewards will still work). 2016-03-17 09:19:27 -07:00
Justin Shreve 3eacb992bc Address issues from Mike's Feedback:
* Rename individual use, free shipping, and exclude sale items to match their meta names closer.
* Sanitize emails when using set_email_restrictions
* Remove some unnecessary explict true checks
* Move ID into _data with the rest of the fields
* Fixed some spacing issues
2016-03-17 09:19:27 -07:00
Justin Shreve 447462b274 Allow access to coupon properties directly to allow for back-compat usage, but throw a deprecated notice. Also adds a test to make sure these properties work as they should. 2016-03-17 09:19:27 -07:00
Justin Shreve d738dec05d Coupon CRUD (WIP). 2016-03-17 09:19:27 -07:00
Mike Jolley f1eefa902c [2.5] When getting coupon by code used twice, latest should be queried
Closes #10487
2016-03-07 13:08:02 +00:00
Mike Jolley 1979138666 Use unformatted coupon post title for comparison
Fixes #10476
2016-03-04 15:55:46 +00:00
Mike Jolley f9d019df87 [2.5] Fix query/missing variable in validate_user_usage_limit
Closes #10122
2016-01-21 19:06:42 +00:00
Mike Jolley e15c123510 Fix - Missing validation rule for product cat exclusion coupons (validate_excluded_product_categories)
Fixes #10058
2016-01-12 09:49:46 +00:00
Fredrik Forsmo 0f74f805b0 Improve docblock comments in WC_Coupon class
* Added missing throws tags to various methods
2016-01-06 15:53:59 +01:00
Mike Jolley 9aee0ac1cb Functions and filters to determine which coupons need product and cart validation rules.
Closes #9854
2015-12-16 11:47:56 +00:00
Mike Jolley 3b409f1bbf For coupons with category restrictions, respect the category hierarchy.
Closes #9704
2015-11-30 12:29:16 +00:00
Claudio Sanches 753014da5a Merge pull request #9631 from woothemes/transient-tweaks
Transient tweaks
2015-11-21 22:48:14 -02:00
Mehdi Esmaeili 101c7f47e1 Better Documentation: Put throws tag 2015-11-17 16:21:42 +03:30
Mike Jolley e6859dc0f4 Change get_coupon_id_from_code to use wp_cache instead of transient
Persistent caching is more relevant here. Smaller stores won’t see much
gain from using the transient.

This commit also removes the woocommerce_coupon_code_query filter due
to limitations of it being within a prepare() call. Checked github and
no plugins appear to use this filter so should have minimal impact.
woocommerce_get_coupon_id_from_code filter added in place.
2015-11-13 23:09:35 +00:00