Commit Graph

76 Commits

Author SHA1 Message Date
Claudio Sanches 6e6ca196f9
Merge branch 'master' into fix/23340 2019-07-09 16:32:43 -03:00
vedanshujain 8ab6cb2b5a Round late when rounding at subtotal to reduce rounding error.
We were earlier rounding different tax rate values while they are merged, even if rounding at subtotal setting is enabled. This increases the rounding error, especially when prices are inclusive of taxes, and thus there is a chance that the total will be slightly different from when add the original values. For egs: https://github.com/woocommerce/woocommerce/issues/23917 .

This commit changes this behavior to round *after* we have summed all the precise unround values. Similar for items prices, we now round as late as possible, if rounding at subtotal is enabled.
2019-07-04 22:34:29 +05:30
Mike Jolley 33b1c4205b Fix cart tests - move round so taxes are correct 2019-04-17 16:49:46 +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 a77578a989
Merge pull request #22347 from woocommerce/fix/20911
Tweak tax handling when exempt of VAT and woocommerce_adjust_non_base…
2019-01-31 13:33:36 +00:00
Mike Jolley 2d14315f3d woocommerce_cart_totals_get_item_tax_rates 2019-01-21 15:38:48 +00:00
RobertoDonPedro 3a2b3d10ad
Filter get_item_tax_rates in class-wc-cart-totals.php
Adds filter on the return value of function 'get_item_tax_rates' to prevent the mandatory caching of tax rates, described in https://github.com/woocommerce/woocommerce/issues/21855
2019-01-17 13:57:31 +01:00
Mike Jolley 50af71b9bd Calculated items_subtotal_tax using rounded tax subtotals. 2019-01-11 12:59:23 +00:00
Mike Jolley 96ba549b2b Remove type hint 2019-01-10 13:23:49 +00:00
Mike Jolley f67ab4e447 correct version 2019-01-10 13:20:02 +00:00
Mike Jolley 82365fd6d2 Tweak tax handling when exempt of VAT and woocommerce_adjust_non_base_location_prices is off 2019-01-04 16:46:52 +00:00
Grzegorz Rola 9df10fac5a Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked. 2018-08-29 13:43:13 +02:00
Grzegorz Rola 20ac4a8b69 Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked. 2018-08-29 13:34:22 +02:00
Grzegorz Rola 5c3f4c9c10 Revert "Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked."
This reverts commit dafcbc5
2018-08-29 13:25:22 +02:00
Grzegorz Rola dafcbc56b0 Taxes should be rounded on subtotals in cart when option woocommerce_tax_round_at_subtotal is checked. 2018-08-29 13:22:51 +02:00
Boro Sitnikovski 15cbe7daee Pass current object as context 2018-06-20 14:16:14 +02:00
Boro Sitnikovski 1b90d8114c Add filter for tax calculation in cart totals 2018-06-20 10:51:05 +02:00
Mike Jolley e677340fcc No need to load tax rates when taxes are disabled 2018-05-01 11:56:39 +01:00
Claudio Sanches 67cd6b8fbf Fixed includes/class-wc-cart-totals.php PHPCS violations 2018-03-16 14:47:18 -03:00
claudiulodro f39a9ee61a Round fractional cents when oob 2018-03-14 08:35:41 -07:00
Torre Lasley 64f85346c0 Add filter to allow plugins to override the default coupon apply order. (#19339)
* Fix for Issue #10523 - Variations ID lookup by SKU

I copied the code from the bulk() function to look up the Variation ID by the Variation SKU if the Variation ID is missing.

* Added new filter woocommerce_coupon_sort to allow plugins to override the default coupon apply order.
2018-03-13 10:26:22 +00:00
Mike Jolley a44e4f64ac Round correctly when removing taxes from prices. 2018-01-05 14:56:33 +00:00
Mike Jolley 7a94bf06df Reversion changes 2017-12-07 15:39:10 +00:00
Mike Jolley 7e7b79efd0 typo 2017-12-07 15:31:55 +00:00
Mike Jolley b6f87e70d7 round total to cents 2017-12-04 22:42:39 +00:00
Mike Jolley 7da5780c00 Store unrounded, calc rounded. 2017-12-04 21:40:12 +00:00
Mike Jolley 277127a400 Round line totals and taxes per line correctly to the store DP setting. 2017-12-04 20:38:00 +00:00
Mike Jolley 6ef391666f Only remove base taxes in cart totals class if item is taxable
Fixes #17880
2017-11-23 11:08:10 +00:00
Mike Jolley 15230e295c Add precision after multiplying quantity
Closes #17860

Has no effect on core it seems because we only store prices to the DP
setting. This would be to correct precision added by plugins.
2017-11-22 10:49:28 +00:00
Mike Jolley ec5db3b123 When adding precision to taxes, don't round when adding precision. 2017-11-20 16:30:23 +00:00
Mike Jolley 040443a04d Out of base rounding error fixes 2017-11-02 20:00:49 +00:00
Mike Jolley 9ea088f6c9 Adjust discount logic when out of base 2017-11-02 16:18:51 +00:00
Mike Jolley 65f2ee0f49 Cart totals: don't add shipping unless show_shipping is true.
Closes #17412
2017-10-27 17:30:33 +01:00
Claudiu Lodromanean 3aa43ed5d2 Calculate shipping after discounts (#17364)
* Calculate shipping after discounts

* Calculate grand total after shipping is calculated

* Keep fees calculation before shipping
2017-10-26 15:27:10 +01:00
Mike Jolley f27c8a226f Fix issue when customer is VAT exempt and prices include tax
Ref: https://github.com/woocommerce/woocommerce-eu-vat-number/issues/82

In this scenario, base taxes need to be removed from the item price.
2017-10-18 09:31:35 -07:00
Mike Jolley d694483735 Fix tax display issue for discounts 2017-10-13 14:36:35 +01:00
Mike Jolley 4f3393fc2f Tax calculations should use `unfiltered` context for tax class
This fixes variations which have a ‘parent’ tax class. It should
inherit from the parent.

Closes #17147
2017-10-12 10:12:20 +01:00
lars ac24a56ff3 #16938 rename filter for clarity 2017-10-04 10:56:56 +02:00
lars 73bc8b8e6c added actions and filters to modify tax calculation for shipping taxes and fee taxes #16938
Filters and actions are needed to ensure correct tax calculation by
German law.

The filter in class-wc-cart-totals.php is used to modify fee tax
calculation during checkout and in cart.

The actions in the other files are used to modify tax calculation in
backend for manual orders.
2017-09-28 12:52:55 +02:00
Mike Jolley f1f56423c0 Docblocks 2017-09-27 17:16:33 +01:00
Mike Jolley 40040f534b These classes require WC_Cart objects 2017-09-27 17:12:45 +01:00
Mike Jolley 5151415eec Merge branch 'discounts-class-fixes-and-tests' 2017-09-20 18:44:18 +01:00
Mike Jolley 21dfde842a Revised coupon sort order to not rely on IDs which can differ between cart and tests
Also edited test to match
2017-09-20 18:41:48 +01:00
Mike Jolley d3da954133 Move cart totals setter for 3.1 compat
Closes #16794
2017-09-15 11:15:50 -07:00
Mike Jolley 804feb9333 Store fee amount and prevent totals going negative 2017-08-23 12:15:06 +01:00
Mike Jolley 559982fbe7 Unused variable 2017-08-22 17:02:48 +01:00
Mike Jolley 00cb48a5fe Pass through to order 2017-08-22 16:20:23 +01:00
Mike Jolley 367f08d79f Negative fee logic for cart 2017-08-22 16:12:37 +01:00
Mike Jolley 1c8ad67a9e Fix tests and tax merges 2017-08-18 15:05:01 +01:00
Mike Jolley b854c1775c Tests 2017-08-18 13:53:22 +01:00