Commit Graph

462 Commits

Author SHA1 Message Date
vedanshujain fc6ae313e3 Do not use `wc_round_tax_total` in shipping tax for accuracy.
`wc_round_tax_total` is for when prices are inclusive of taxes, however, shipping taxes can never include taxes so they should always use `round( $price, wc_price_get_decimals() )` instead.
2020-07-24 19:12:25 +05:30
vedanshujain 541d9ca483 Remove individual rounding because lines would have already rounded.
When rounding at subtotal is enabled, line items are already rounded where they need to, so we only should do any further rounding when displaying values and no where else.

This is part of our larger attempt to remove individual rounding as much as possible.
2020-07-24 19:09:59 +05:30
Christopher Allford 2ef15f02e3 Renamed `WC_Cart::is_tax_displayed()` to `WC_Cart::get_tax_price_display_mode()` to clarify intent 2020-07-13 07:21:19 -07:00
Christopher Allford c2bf58a739 Fixed the accessibility of WC_Cart::is_tax_displayed()
Since we're calling the function from the base class we need it to be protected or this throws a fatal exception.
2020-07-09 13:39:16 -07:00
Néstor Soriano 7fa34c6770
Merge pull request #26400 from woocommerce/fix/26242
Make WC_Cart::display_prices_including_tax() aware of tax display changes
2020-07-02 14:56:50 +02:00
Vedanshu Jain b45373fe0c Revert "Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout"" 2020-06-05 15:18:01 +05:30
Claudio Sanches 5445d34283 Remove deprecated attribute 2020-06-02 13:57:55 -03:00
Claudio Sanches e0105f124f Deprecate WC_Cart->tax_display_cart 2020-06-02 13:55:29 -03:00
Claudio Sanches 77c6ddda92 Make display_prices_including_tax() aware of tax display changes 2020-05-07 00:03:48 -03:00
Vedanshu Jain ee119e0a7e
Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout" 2020-04-21 15:37:21 +05:30
Vedanshu Jain 3bf473517d
Merge pull request #25708 from woocommerce/update/reserve-stock-for-checkout
Introduce a `reserved stock` class and database table to prevent race conditions during checkout
2020-04-07 02:16:22 +05:30
Vedanshu Jain 237463c39b
Merge pull request #25800 from woocommerce/fix/25748
Fixes tax rounding issues
2020-04-07 00:24:34 +05:30
Mike Jolley 02cf328afe Remove check for held stock minutes during stock checks - this will be handled elsewhere 2020-04-03 15:55:14 +01:00
vedanshujain 8adb474149 Enforce per user coupon usage limit for guest user checkout.
In a previous commit, a regression was introduced where we were no
longer checking for usage limit of guest user in an install. This
commit adds back that check.
2020-04-02 15:00:06 +00:00
vedanshujain 15d4bd7381 Don't individual tax lines to honour "Round at subtotal" setting. 2020-03-02 15:19:16 +05:30
Peter Fabian 150c77ba29 Improve coupon name output handling. 2020-02-26 12:24:04 +01:00
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