rounding error with taxes

Hi there,

there seems to be a rounding error with german(?) taxes. Here is what my basket is calculating:

Base Country: Germany

Store Currency: Euro

VAT Tax Rate; 19%

Apply Tax To Shipping Fees? No

Enter Prices Inclusive of Tax? Yes

shopping-cart shows:

T-Shirt 14.00€

Girlie-Shirt 14.00€

Shipping: 5.00€

Taxes: 4.47€

Cart Total: 32.99€

Any ideas how to fix this?

Thanks a lot!

  • Aaron
    • CTO

    The numbers look correct here to me when I calculate manually. What’s the problem?

    If you were not using inclusive tax pricing, this is what it would equate to:

    T-Shirt 11.76€

    Girlie-Shirt 11.76€

    Shipping: 5.00€

    Taxes: 4.47€

    Cart Total: 32.99€

    As far as the 1 cent rounding issue in that other thread, there isn’t really a way to fix it. It’s a necessary artifact of using inclusive tax pricing and compatibility with gateways which require a rounded line item before tax price that matches the total.

  • Matthias Ambre
    • New Recruit

    Hi there,

    thank you for your answer. Well first, its not such easy to tell your customer that he buys 14, 14 and 5 and has to pay 32.99, not 33. Looks like something is wrong. Here in germany normally all prices are inclusive taxes.

    I think the problem is, when you mix adding and rounding.

    # 1st calculation method:

    A_brutto = 14

    B_brutto = 14

    A_netto = A_brutto/1.19 = 11.7647058823529 ~ 11.76

    B_netto = B_brutto/1.19 = 11.7647058823529 ~ 11.76

    A_tax = (A_brutto/119)*19 = 2,23529411764707 ~ 2.24

    B_tax = (A_brutto/119)*19 = 2,23529411764707 ~ 2.24

    SUM_netto = 11,76 + 11,76 = 23,52

    SUM_tax = 2.24 + 2.24 = 4.48 (!)

    SUM = SUM_netto + SUM_brutto = 28 –> correct

    # 2nd calculation method:

    SUM = 14 + 14 = 28

    SUM_netto = 28/1.19 = 23.5294117647059 ~ 23,53

    SUM_tax = (28/119)*19 = 4,47058823529414 ~ 4,47

    So, im sorry to disagree. Only if you mix both calculation methods you will get rounding problems…

  • Matthias Ambre
    • New Recruit

    Hi there, thank you.

    Well i think it isnt a problem if taxes are ±1cent, but i think the total should be the correct addition of the single items.

    Well.. i could try to check that myself. Hm… is this the function to have a look at?

    #marketpress.php line 2038
    function tax_price($format = false, $cart = false) {

  • Matthias Ambre
    • New Recruit

    PS: germany seems to be a really really complicated country :wink: The biggest problem is, that we have 2 tax rates, depending on the kind of product. So if you sell a Shirt you have 19% taxes inc, if you sell a CD or a book you have 7% tax inc, And on your invoice you need a line for the 7% and one for the 19% taxes included. Well.. I won’t ask you for a feature like this… :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.