Commit Graph

496 Commits

Author SHA1 Message Date
Peter Fabian 46dd915044 Improve coupon notice handling. 2020-02-05 18:50:40 +01:00
vedanshujain 72545c44b7 Add support for `_held_for_checkout` records to improve performance.
This will also improve transactional stability and avoid race conditions by providing a way to lock usage counts.
2019-12-17 19:13:19 +05:30
Arnaud Faucon e8b1d617a1 pass the clear persistent cart variable to the cart emptied actions 2019-10-30 09:14:45 +01:00
Rodrigo Primo d89e0cee84
Merge pull request #24176 from woocommerce/fix/issue-23750
Add more specific reason for why products cannot be purchased so plug…
2019-08-23 11:13:31 -03:00
David Stone 487b38e0ae Use two different filters instead to avoid unexpected behavior 2019-07-24 16:54:51 -06:00
David Stone db089c3f9d Only use default message to avoid showing too much information to user 2019-07-19 15:37:10 -06:00
James Allan dd47170c7d Deprecate the woocommerce_before_cart_item_quantity_zero action
This action was removed in 921cc754b9.
It will need to be deprecated so third-parties are made aware the new alternative.
2019-07-18 11:18:21 +10:00
David Stone 50d9c73809 Add more specific reason for why products cannot be purchased so plugin can custimize these messages 2019-07-16 12:49:50 -06:00
Rodrigo Primo 3fed0d7cbc
Merge pull request #23112 from woocommerce/fix/persistent-cart-filter
Persistent cart improvements
2019-05-21 15:07:55 -03:00
Mike Jolley 11db10807d Add check for VAT excemption inside display_prices_including_tax 2019-04-03 11:36:43 +01:00
Mike Jolley 921cc754b9 Improved usefulness of set_quantity
Due to the way set_quantity works there are multiple paths that can be taken and multiple hooks to monitor for updates. woocommerce_before_cart_item_quantity_zero for example was only fired when qty hits zero, however, there are other hooks to monitor which do the same thing (remove from cart) e.g. woocommerce_cart_item_removed.

This uses the `remove_cart_item` method so that hook is always fired, and zero hook is no longer needed.

Added woocommerce_after_cart_item_quantity_update action to capture the other cases (when  qty is updated).
2019-03-22 13:04:47 +00:00
Gabriel e442f46db3
Update class-wc-cart.php 2019-02-28 21:56:43 +01:00
Gabriel 8a9990f98d
[ADD] Do Action before cart is emptied 2019-02-25 06:01:38 +01:00
Mike Jolley b8921f9fba
Merge pull request #22420 from woocommerce/refactor/tax-rounding-methods
Refactor tax rounding methods for consistency
2019-02-12 16:13:58 +00:00
Mike Jolley 40694118fc Merge branch 'pr/21050' 2019-01-31 15:47:52 +00:00
Mike Jolley 25ebc45fbc Make consistent with checkout and rename filter 2019-01-31 15:46:26 +00:00
Mike Jolley dabfe66464 Correct use of rounding functions in cart class 2019-01-11 12:41:06 +00:00
Mike Jolley 11d14b30a4 PHPCS fixes 2019-01-11 12:28:52 +00:00
Mike Jolley 981ddcfe34
Merge pull request #22167 from Prospress/fix/22161
Apply email usage restriction comparison to entire string
2019-01-07 12:31:12 +00:00
JeroenSormani f4775ccd90 Use shipping method instead of property through magic + doc return statements 2019-01-04 12:41:38 +00:00
Ron Rennick 2b74017200 apply usage restriction compare to entire string 2018-12-06 12:32:04 -06:00
Ron Rennick 8c852780ea phpcs sniff fixes for class-wc-cart.php 2018-12-06 12:31:21 -06:00
Jeremy Madison 17c43ffa5d Add woocommerce_hold_stock_minutes check back to calculation 2018-11-02 12:25:58 -07:00
Gerhard 560a49a3b2 Use a cleaner approach to prevent loading cart from session to call itself. 2018-10-30 11:58:39 +02:00
Gerhard b808c70c44 Do not populate cart from session when ordering again and using the get_cart in a hook, the order again functionality already loads the cart from session, which get_cart does as well causing infinite loops. 2018-10-30 11:52:00 +02:00
Boro Sitnikovski 8c6226e7bd Introduce a new filter for 'get_cart_contents' 2018-10-29 21:08:22 +01:00
claudiulodro 874ee8895d Revert show shipping behavior change 2018-10-24 13:09:32 -07:00
claudiulodro 84e5de5eef Add address_1 to shipping packages info 2018-10-03 14:31:35 -04:00
andgrankin 526e3826e8
Update documentation
Update documentation for methods set_coupon_discount_totals and set_coupon_discount_tax_totals
2018-09-26 22:43:17 +07:00
Gerhard Potgieter e69900a4d6 Shipping totals should show even if calculator is disabled. 2018-09-17 13:43:32 +02:00
Peter Fabian cf3f54ec64 Made tax display in cart depend on whether customer is tax exempt. 2018-09-06 17:40:21 +02:00
Florian Ludwig 3e4791fbb4 Fixes wrong usage of deprecated get_cart_for_session 2018-09-05 10:16:01 +02:00
Nico Mollet cc9e904cfc
Standardize case of button View cart
Hello,

In this WC_Cart class, there are two string for `View cart`.
Line 1037 and line 1065.

The other `button wc-forward` buttons are first character uppercase only.

The PR changes `View Cart` to `View cart`.
Thank you
2018-08-15 09:13:59 +02:00
Boro Sitnikovski 1c4ef011d2 Add new filter to allow modifications of cart contents 2018-08-14 18:34:52 +02:00
Florian Ludwig 0f6f6814ad Moves cart hash calculation to WC_Cart class 2018-08-14 18:08:55 +02:00
maciekpaprocki db403b2805
Wrong php doc for get_cart_contents() 2018-07-01 18:12:04 +01:00
Mike Jolley d394dec5f2
Merge pull request #20591 from yratof/tweak/issue-20590
Wrapped 'FREE' with a filter to allow different use cases
2018-06-26 13:43:44 +01:00
Andrew Lazarus d9c031d8c6
Removed whitespace to pass travis check 2018-06-25 13:24:07 +02:00
Andrew Lazarus c9e0055bdd
Refactored get_cart_shipping_total()
Refactored to pass all routes through filter, renamed the filter to match the function.
2018-06-25 11:17:08 +02:00
Andrew Lazarus 7eac354d3b
Added $this to the FREE filter to allow interaction with cart object 2018-06-22 16:03:57 +02:00
Andrew Lazarus b29036c08d
Updated filter naming convention for Free! 2018-06-22 16:00:28 +02:00
Rodrigo Primo e6c1ab38a8 Fix PHPCS error 2018-06-22 10:31:42 -03:00
Andrew Lazarus 38b904a09a Wrapped 'FREE' with a filter to allow different use cases for no shipping rate returning 2018-06-20 15:12:27 +02:00
Mike Jolley 5e6405b650 Merge branch 'master' into update/13359 2018-06-15 15:12:12 +01:00
Mike Jolley e92463632b Held stock qty check for pay page 2018-06-08 16:58:33 +01:00
Mike Jolley d76474789d variable name 2018-06-08 16:30:58 +01:00
Mike Jolley e38eccf828 Check pending orders even when hold stock is disabled 2018-06-07 17:42:23 +01:00
Mike Jolley 67dc3ea80a Hide rates when there are no rates and calculator is off 2018-06-01 21:28:21 +01:00
Mike Jolley 87b077e57a Check billing email is posted before using
Closes #20178
2018-05-23 15:04:03 +01:00
Mike Jolley 9c2edf4983 Moves around some includes so they are included before the autoloader needs to find them 2018-05-22 12:57:48 +01:00
Claudio Sanches 84c047dad1 Fixed includes/class-wc-cart.php PHPCS violations 2018-03-16 15:08:52 -03:00
Mike Jolley 1b905b2975
Merge pull request #19331 from woocommerce/add/coupon-wildcard-email
Add wildcard email support for coupons.
2018-03-13 10:05:06 +00:00
Gerhard Potgieter 01775a4443 Missing space 2018-03-13 07:34:47 +02:00
Claudio Sanches 768a21e788 Check if product has weight before calculate weigth total in cart
Closes #19347
2018-03-12 12:54:00 -03:00
Gerhard Potgieter 3910fbc270 Update method name 2018-03-09 11:00:57 +02:00
Gerhard Potgieter 1840d594ee Add wildcard email support for coupons.
Co-authored-by: l4ll3x
2018-03-09 10:57:12 +02:00
Mike Jolley 46862deb17 wc_get_cart_item_data_hash function 2018-03-05 19:57:57 +00:00
Mike Jolley 1901493eee Should be pulic. 2017-12-15 15:18:17 +00:00
Mike Jolley 01871fd2c8 Add getter for tax_display_cart variable, with filter 2017-12-15 13:39:35 +00:00
James Allan 82c282e83a Clone the child objects rather than instantiating new objects.
When cloning the cart, the current fees and session objects should
remain the same but have new pointers.
2017-12-08 21:15:45 +10:00
James Allan 83de162adb Only remove fees which belong to the cart which is being emptied/reset
If there are multiple instances of WC_Cart and therefore multiple
instances of WC_Cart_Fees, if 1 cart is emptied and
woocommerce_cart_emptied is triggered, all instances of WC_Cart_Fees
will trigger remove_all_fees, removing all the fees from all the carts.
2017-12-08 21:15:08 +10:00
Boro Sitnikovski d0f9aaa99a Merge branch 'master' into tweak/decouple-cart-template-methods 2017-12-07 20:16:08 +01:00
Boro Sitnikovski 588c5f3779 Change method name 2017-12-07 15:53:16 +01:00
Boro Sitnikovski 145d47c580 Decouple cart templating methods from WC_Cart class 2017-12-05 13:00:21 +01:00
Mike Jolley 17095a4011 Totals should be set to store DP setting. 2017-12-04 20:38:14 +00:00
JeroenSormani b96fea3e47 Add quantity arg to woocommerce_add_cart_item_data filter 2017-11-21 16:01:23 +01:00
Mike Jolley 8b02185596
Merge pull request #17817 from JeroenSormani/exclude-virtual-from-shipping-tax
Exclude virtual tax classes from calcluation for shipping taxes
2017-11-21 13:21:13 +00:00
JeroenSormani 14e5bcd51d Exclude virtual tax classes from calcluation for shipping taxes 2017-11-20 20:14:23 +01:00
Mike Jolley 78466a6665
Merge pull request #17599 from JPry/allow_clone_cart
Allow for cloning the WC_Cart object
2017-11-10 12:02:59 +00:00
Claudio Sanches 9979e4b3e5
Merge pull request #17589 from woocommerce/fix/17585
get_total_ex_tax should exclude fee taxes
2017-11-08 19:05:23 -02:00
Jeremy Pry 0e43551535 Move inline comment into the docblock 2017-11-08 10:18:08 -05:00
Jeremy Pry cf5bd606c6 Rename register_hooks() to init() 2017-11-08 10:17:52 -05:00
Mike Jolley 827d133cb2 Improve tests 2017-11-08 13:54:33 +00:00
claudiulodro 0e983c4fe9 Allow removing coupons even if coupons disabled 2017-11-07 10:33:11 -08:00
Mike Jolley c6c6a1e4b3 Grab all taxes individually 2017-11-06 16:34:45 +00:00
Mike Jolley 1b49e9a568 get_total_ex_tax should exclude fee taxes
Closes #17585
2017-11-06 16:18:21 +00:00
Jeremy Pry 9eee3805c0 Allow for cloning the cart object
This handles creating new instances of the `$session` and `$fees_api` properties.
2017-11-03 15:50:43 -04:00
Jeremy Pry 0cca83ff83 Add separate methods to register hooks
This facilitates cloning the cart without registering additonal hooks unnecessarily.
2017-11-03 15:49:45 -04:00
Dan Wyman 4c16aeac6d Coupon user limit check fix
Fixes a where clause problem. Fixes #17235 .
2017-10-16 18:40:46 +01:00
Mike Jolley 803b31a18c Switched to property_exists and moved deprecation notice to avoid errors and setting fees unnecessarily. 2017-10-13 13:46:49 +01:00
Boro Sitnikovski b11ed6e3db Fix direct access to props on checkout 2017-09-27 16:25:45 +02:00
Brent Shepherd 89e932c338 Fix shipping tax when calling calculate_shipping()
The $shipping_taxes is a multidimensional array so array_sum() does not
correctly sum the values. The $merged_taxes is a single level array with
all other taxes set, so array_sum() can be safely used on it.
2017-09-21 16:48:32 -07:00
Claudiu Lodromanean e713b5beb3 Merge pull request #16869 from woocommerce/fix/16861
Fix legacy access to array props (fees, taxes, coupon totals + taxes)
2017-09-21 09:47:29 -07:00
Brent Shepherd 470c5f7a1d Use __FUNCTION__ for filter hook name
To avoid including the WC_Cart class name and a double colon.

Example hook from WC_Cart::get_total():
 * Before this PR: woocommerce_cart_WC_Cart::get_total
 * After this PR: woocommerce_cart_get_total
2017-09-20 14:45:37 -07:00
Mike Jolley eb79566985 Fix legacy access to array props (fees, taxes, coupon totals + taxes)
Closes #16861
2017-09-20 15:39:05 +01:00
Gabor Javorszky d3ade84852 Add cart object to filters with quantity updates
No issue.

Other filters (remove cart item, restore cart item) have the cart object passed as well. These ones should be too.
2017-09-05 16:40:44 +01:00
claudiulodro 734ed70462 Fall back to defaults if not set in cart 2017-08-28 14:12:35 -07:00
Mike Jolley 22813663d7 Merge pull request #16569 from woocommerce/update/fees-api-class
WC_Cart_fees and negative fee calculations
2017-08-23 10:59:19 +01:00
Mike Jolley 00cb48a5fe Pass through to order 2017-08-22 16:20:23 +01:00
Mike Jolley 57865204aa Cart fees class and legacy 2017-08-22 15:17:58 +01:00
Umangvaghela 5794a9cb34 Update condition 2017-08-22 15:23:34 +05:30
Mike Jolley 3d002f842f Fix get totals method 2017-08-18 17:18:41 +01:00
Mike Jolley 4567169aa9 Fix remove from cart 2017-08-18 16:37:24 +01:00
Mike Jolley 1c8ad67a9e Fix tests and tax merges 2017-08-18 15:05:01 +01:00
Mike Jolley 302512e51f Combine taxes correctly 2017-08-18 13:48:53 +01:00
Mike Jolley a2858245fe Remove call - it's hooked 2017-08-18 12:52:29 +01:00
Mike Jolley d2e3839d99 Use getters and setters in cart class 2017-08-18 12:51:45 +01:00
Mike Jolley a190dc79c3 Legacy getters/setters 2017-08-18 12:24:17 +01:00
Mike Jolley b9fea8419b getters and setters for totals 2017-08-18 12:05:18 +01:00
Mike Jolley 0c751087f9 Cast to arrays 2017-08-18 11:44:07 +01:00