Nestor Soriano
52eed70f04
Add a 'NumberUtil' class with a 'round' method.
...
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.
This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Nestor Soriano
b1e81d02da
Fix code style/sniffer errors in a few files.
2020-10-01 11:08:51 +02:00
Christopher Allford
ae697f9fe2
Prevented zero from being considered empty when validating posted variation attributes
2020-09-09 11:29:31 -07:00
vedanshujain
7f2b322085
Check for state and postcode fields only if required
...
We were doing state and postcode even for countries where its not required, but unfortunately as an unintended effect we were ending up not checking shipping requirements if this was not met.
2020-09-09 18:21:14 +05:30
Ron Rennick
bbdafb5cb1
Merge pull request #26196 from fitimvata/master
...
Add filter woocommerce_cart_item_required_stock_is_not_enough
2020-08-28 15:34:46 -03:00
Ron Rennick
af162d8bed
Updated `@since` for the filter
2020-08-28 15:33:43 -03:00
Claudio Sanches
37291abc54
Added since tag in new filters introduced in 4.5
2020-08-17 18:01:41 -03:00
Claudio Sanches
e102ec3d83
Merge branch 'master' into fix/25133
2020-08-17 14:59:49 -03:00
Claudio Sanches
29bc98816e
Merge pull request #27143 from woocommerce/fix/26876
...
Fix "Hide shipping costs until an address is entered"
2020-08-11 20:06:17 -03:00
Ron Rennick
8a1b8d6a3d
Merge pull request #26439 from kevinruscoe/add-additional-stock-cart-filter-messages
...
Add additional cart filters for stock actions
2020-08-10 16:34:24 -03:00
Claudio Sanches
02cf0dfaed
Merge pull request #27239 from woocommerce/fix/package-tag
...
Fix usage of "package" tag in file headers
2020-08-07 13:37:24 -03:00
Claudio Sanches
d48f1d4e2e
Fixed package tag usage
2020-08-05 13:36:24 -03:00
Claudio Sanches
08620cf846
Make "woocommerce_shipping_cost_requires_address" strict
2020-07-27 21:49:33 -03:00
Claudio Sanches
6ee47b0356
Prevent breakage if coupons code get updated while there's some cart sessions
2020-07-27 16:48:15 -03:00
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
Claudio Sanches
64f4fb85e2
Move variation validation logic to add to cart
2020-07-23 19:10:42 -03:00
Claudio Sanches
133462d645
Update class-wc-cart.php
2020-07-21 13:13:10 -03:00
Claudio Sanches
7b7102c9de
Fixed typo
2020-07-21 13:12:39 -03:00
Claudio Sanches
85f81d0e0b
Add docblock
2020-07-21 13:10:43 -03:00
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
Fitim
963bbcfca3
[woocommerce_cart_has_enough_stock_for_product] Invert the logic, change hook name
2020-06-26 09:38:44 +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
Kevin Ruscoe
6fa5977579
Add filters
...
Adds woocommerce_cart_product_cannot_add_another_message, woocommerce_cart_product_out_of_stock_message, woocommerce_cart_product_not_enough_stock_message
2020-05-09 12:03:43 +01: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
Fitim
c28c8e6472
Add filter woocommerce_cart_has_enough_stock_for_product in WC_Cart::check_cart_item_stock method
2020-04-16 12:16:11 +02:00
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