Sometimes you will need / want to display the price including tax on the line items of your cart. When you do this, you may see differences in the totals, using the calculators in Commerce, between the sum of the prices in your cart as they are displayed and the sum from the calculator.
This is caused by the fact that the DefaultTaxCalculator rounds the sum after all line items are processed. To prevent this round the tax value of the line item before adding it to the total.
The only line that needed to be changed is located in the CalculateTaxTotal method :
amount1 += GetTaxes(taxValues, TaxType.SalesTax, num3); amount1 += currency.Round(GetTaxes(taxValues, TaxType.SalesTax, num3));
See full code for the calculator in this gist
You may want to have a look at Son Do’s post as well on how to integrate the calculator with Commerce Manager as well.
Hi Jeroen!
Thanks for this, I got a bit closer to solving my problem with this article, but I still have a problem with taxes and discounts. Could I maybe have your input on this?
http://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2017/10/problems-with-vat-calculation-when-using-discount-code/
Thanks!
/Kristoffer
LikeLike
I may have some time later in the week to have a look at it
LikeLike