How to add tax to total

how to add tax to total

Adding A Custom Discount Order Total in Magento Does Not Change Sales Tax

I have created a custom order total that gives a discount in certain situations. The grand total always comes out correct, however the sales tax calculation is not taking my discount into account when calculating (so if I was giving a discount of $10, the sales tax amount was calculated on the entire amount before my discount).

Take for example the following:

My custom discount is the Multi Unit Discounts. The tax rate is 6%. As you can see the grand total is correct based on all the line items, but the tax amount itself is not correct (it is based on all the line items except my discount).

In my config.xml file I have the following to get my order total working in the system:

The following is the contents of my order total class:

For the sake of not posting a huge

chunk of code in here that I am not sure is necessary, I can tell you that the helper in the above code simply returns the amount of money the discount is for that particular item in the quote.

Can someone help point me in the right direction for getting the sales tax calculation correct?


In order to keep this simple, I have removed a lot of my logic behind calculating the discount and am now trying to simple take $10 off the order total as a discount. As suggested I did not modify the Grand Total of the address and am now only setting the Discount Amount and Base Discount Amount. Now the sales tax does not add up and the grand total is off. Maybe if there is a good tutorial out there that someone can point me towards would help? I do not seem to be grasping how the order totals all interact with each other.


Category: Taxes

Similar articles: