Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In a recent order, ubercart displayed the following:
Subtotal: $194.95
UPS Ground: $11.50
Subtotal excluding taxes: $206.45
Maryland Tax 6%: $11.70
Total: $218.14
If you do the math and add up the line items, the total should be $218.15
I looked in the database and found the actual saved numbers
Subtotal: $194.95
UPS Ground: $11.49750
Subtotal excluding taxes: $206.4475 (my calculation)
Maryland Tax 6%: $11.69700
Total: $218.14450
So it would seem there is an issue with rounding - perhaps the subtotal excluding taxes should not have utilized the rounded UPS value in it's calculation.
Comments
Comment #1
j.mead CreditAttribution: j.mead commentedpossibly related issue with paypal orders here - http://drupal.org/node/882560 as I can confirm that rounding on the order total throws an error to my logs, but doesn't have any adverse effects
Island Usurper put up a patch specifically for the PayPal total component, maybe you can adapt the patch to apply where you're getting the error or maybe ask him to look into it?
Comment #2
ergophobe CreditAttribution: ergophobe commentedStruggling with this too.
I've run a bunch of price/tax combos and the issue is simply this
- the tax line item is rounded.
- the order total is truncated.
So let's say you have this
order total: 95.00
shipping: 5.00
tax: 12.34567
You'll end up with
Tax: 12.35 (correct)
Order: 112.34 (truncated, rather than rounded).
For me it is always a 0.01 error, with the order total always being correct if tax is rounded down, and 0.01 low if tax is rounded up.
Comment #3
ergophobe CreditAttribution: ergophobe commentedOkay so I have the same issue, but with the USPS module because it gets price quotes to three places past the decimal point and taxes are also carried out past the decimal point.
So in my order summary, it displays
Subtotal: $149.87
U.S.P.S. Parcel Post: $6.00
Subtotal excluding taxes: $155.87
CA Sales Tax: $12.74
Order total: $168.60 but it *should* be 168.61
But here's the thing, the *actual* values as stored by Ubercart are
U.S.P.S. Parcel Post: $5.995
CA Sales Tax: $12.73895
So order total = 168.60395 which rounds to 168.60
Comment #4
ergophobe CreditAttribution: ergophobe commentedThis is a dupe of #479784: Order rounding