Round up summed tax price components when calculating the order total

Created on 11 September 2015, about 9 years ago
Updated 11 August 2023, over 1 year ago

We have a calculation issue, and I believe it originates with the way the tax are calculated.

From a DPM() inspection, it seems that when the GRAND TOTAL of an order is calculated, rather than taking the values from what is displayed, it goes back to individual items... And recalculates it's tax values from the FLOAT values stored at the ITEM level. This is wrong.

See this example, the subtotal is wrong by 0.01:

PRODUCT | Unit Price | Qty | Sub Total
Pins    |    0.05    | 60  |    3.00 (good)
-----------------------------------------
Subtotal 	                3.00 (good)
Shipping fees 	               81.17 (expensive, but hey... Whatever!)
-----------------------------------------
GST 	                        4.21 (good)
QST 	                        8.40 (good)
-----------------------------------------
Order total 	               96.77 (WRONG !) The Order total should be 96.78

🐛 Bug report
Status

Active

Version

1.0

Component

Tax

Created by

🇨🇦Canada mastap

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada mastap

    In Canada the regulation states that taxes are calculated on the SUM of ALL the items that are taxable.
    Which means that you don't assign tax to items, nor to line items.

    You simply add up ALL the amounts (product, services and shipping) that are taxable for a said tax code.
    THEN you calculate the taxe on this sub total.
    Then you round at THIS level.
    that's it. done. you have the legal amount to tax

Production build 0.71.5 2024