Financing, tax rates, and accounting
Hello Shopify Community,
I am currently building a tool for creating invoices & invoice-reminders.
I ran into a peculiar issue with the tax calculations.
From my understanding this is the workflow:
For each LineItem
then add Shipping costs to TotalPrice and ShippingCost-Taxes to TotalTaxes
then remove all Discounts with targetSelection = ALL from both the total and the taxes
and then we can go ahead and calculate the Tax.
So far so good. I have this example wich really confused me:
4 Products:
in Total: 111,77€
Then an order-wide discount of 20,-€ -> 91,77€
German 19% Tax Rate results in 17,4363€ (then tax = floor(tax*100)/100) ??) => 17,43
this flooring resulted in correct results for most orders but this one got it compleatly wrong.
Shopify says the correct amount of Taxes would be 17.45 ?!?
This is very confusing since not even rounding would result in this value.
I ended up using the order->currentTotalTaxSet but I really want to understand what is causing this inconsistency behind the scenes - or what I am doing wrong.
Hope somebody can help me figure this one out,
best regards ~ Marco
Hello @Marco_Dittrich ,
Let's have a breakdown to understand more:
1x 108.40€ -discounted to-> 54.20€
2x 49.58€ -discounted to-> 24.79€
1x 15.97€ -discounted to-> 7.99€
LinePrice = (1 * 54.20€) + (2 * 24.79€) + (1 * 7.99€) = 111.77€
Order-wide discount:
Total Price after discount = 111.77€ - 20€ = 91.77€
German 19% Tax Rate
Total Taxes without rounding:
Total Taxes = (111.77€ * 0.19) = 21.2573€
To comply with rounding rules, you mentioned using floor(tax*100)/100. Applying this rounding method:
Total Taxes rounded = floor(21.2573 * 100) / 100 = 21.25€
Shopify's reported value:
According to your information, Shopify reports the tax amount as 17.45€.
Discrepancy:
There seems to be a discrepancy between the tax amount you calculated (17.43€) and the value reported by Shopify (17.45€). This could be due to differences in rounding methods or tax calculation logic between your custom tool and Shopify's system.
To investigate the inconsistency further and gain a better understanding, I recommend reaching out to Shopify Support, providing them with the specific details of your example, and asking for clarification on their tax calculation methods and rounding practices. They can offer insights into their system's implementation and help you understand the differences observed in the tax calculations.
Hope this can help.
Jen from TrueProfit
Hello Jen,
thank you for taking your time to understand this issue.
I have already contacted the Shopify Plus supportteam but they pointed me to this forum.
The calculation you have provided does not include the order-wide discount of 20,-€ the tax is calculated afterwards as far as I know. Then we arrive at 91.77 * 0.19 not 111.77 * 0.19 wich is 1.37ct lower that what shopify provides as ground truth.
Hello Marco,
Did you have any luck finding out this issue?
I have the same problem with many of my invoices, but not always.
I have a bookkeeper making me crazy saying everything is wrong....
Kind regards Marloes
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024