Commit Graph

146 Commits

Author SHA1 Message Date
Justin Shreve b41626c555 Implement Coupon Data Store (#12280)
* Implement a Coupon Data Store using CPTs..

* Handle PR feedback.
2016-11-09 12:21:18 +00:00
Justin Shreve 1797c76a14 Implement WC_Data_Store and related code & tests. 2016-11-08 01:39:47 -08:00
Rami Yushuvaev 93d55dade9 add translators comments 2016-10-29 20:32:38 +03:00
Justin Shreve bff6f5f2ad Remove the $id parameter from Customer & Coupon CRUD's update_post_meta fucntion.
This is a private function that will only interact with one specific object ($this->get_id()).
2016-10-19 08:15:49 -07:00
Justin Shreve 2cc04663ee Don't run expiry date through date() if it isn't set. Also don't do a string comparison check on an integer. 2016-09-30 14:16:41 -07:00
Matty ae75f8b8cd Adjusts all references of 'woothemes' to 'woocommerce' in relevant URLs, excluding the Travis CI integration which correctly uses 'woocommerce/woocommerce'. 2016-09-28 12:17:40 +02:00
Justin Shreve e1e6c682b5 * Stop using _ as a prefix for protected or private vars and functions. We have a keyword for that.
* Introduces set_id and get_id to WC_Data for the CRUD classes to share
2016-09-09 05:36:54 -07:00
Aristeides Stathopoulos 39d4d4bd69 Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar 2016-09-02 05:40:36 +03:00
Aristeides Stathopoulos 0516e96843 PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket 2016-09-02 04:33:57 +03:00
Mike Jolley 402d0ff077 Merge branch 'master' into pr/11797
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php
#	includes/api/class-wc-rest-coupons-controller.php
#	includes/class-wc-coupon.php
#	tests/unit-tests/api/coupons.php
#	tests/unit-tests/coupon/crud.php
2016-09-01 11:43:31 +01:00
Mike Jolley d30c54ef84 Fix coupon notice in cart. 2016-08-31 18:11:41 +01:00
Mike Jolley 335a5e262a use switch in read_manual_coupon 2016-08-30 18:58:28 +01:00
Mike Jolley df35845d4d wc_get_coupon_id_by_code 2016-08-30 11:43:53 +01:00
Aristeides Stathopoulos 3267ce6522 WordPress.WhiteSpace.OperatorSpacing.SpacingBefore 2016-08-27 09:16:28 +03:00
Aristeides Stathopoulos 72696901f3 WordPress.WhiteSpace.OperatorSpacing.SpacingAfter 2016-08-27 09:14:06 +03:00
Aristeides Stathopoulos 9543c7fe1c WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis 2016-08-27 07:29:49 +03:00
Aristeides Stathopoulos 82f3cc221e WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis 2016-08-27 07:23:02 +03:00
Aristeides Stathopoulos 17961f6484 WordPress.Arrays.ArrayDeclaration.ValueNoNewline 2016-08-27 06:04:10 +03: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