0

I have created a module in which admin can specify the date range and fixed shipping amount if any order is placed between the date range. Lets say calculated shipping is $100 and admin has specified that shipping amount should be $50, then difference between original shipping and specified shipping amount i.e $100 - $50 i.e $50 should be given as discount.

I have called an event sales_quote_collect_totals_after, where I am calling collectTotals function in my observer. In my observer I have calculated the discount amount and have set the discount amount on address.

But according to configuration settings, the total tax is applied on subtotal + shipping.

Lets say item total is $2000 and shipping total is $100, discount amount is $50, So grand total will be $2000 + $100 - $50 i.e $2050, and tax is about 20%. So tax amount should be $410, but calculated tax amount is appearing 20% of 2100 i.e $420 and grand total including tax is appearing $2050 + $420 i.e $2470 but It should be $2050 + $410 i.e $2460.

Can anyone please tell what I should do to recalculate Tax and Grand totals including tax ?

1 Answer 1

0

Instead of observing the sales_quote_collect_totals_after event to make the changes you should instead register your own set of total models (address total, invoice total, creditmemo total) and configure them to be collected after shipping total and before the tax total.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.