Miscalculation for cart total


#1

Yay, floating point numbers. 10 + 10 = 19.99

Just for your information.

P.S. The new site looks great!


#2

This is quirk with how Shopify deals with VAT calculations and we’ll be changing it as soon as we get time. You’re lucky you got -0.01 instead of +0.01, a penny saved is a penny earned? :D


#3

Yes, just to clarify, this isn’t a floating point error.

Shopify calculates the tax by taking the total ex tax value of all items and then multiplying by the tax rate. This is correct for America, or other places where tax is applied at checkout.

It’s not right for the UK/EU though - well it’s not wrong but seems odd. We’d apply the tax at the line item level, then total the tax inclusive amounts.

I’m poking them with sticks because this is annoying and dumb.


#4

hi jon,

I see what you mean:

(8.33+8.33)*1.2 = 19.992 -> round 19.99
(8.33 * 1.2) = 9.996 -> round 10 -> (plus another 10) -> 20

I was pleasantly surprised in the end because there were no VAT charges when shipping to Canada. Since I was logged in the whole time, the prices would’ve looked a bit better if that was accounted for while shopping, but I do like pleasant surprises.

Nathan.