I am creating an order programmatically in magento but tax is not applied on it. How can i apply tax on order based on address in my script only??

Any help would be appreciated.

2 Answers 2


To create an order programmatically in Magento, you need to create the quote first then you can create the order from the quote. You need to set setTotalsCollectedFlag(false) in the quote before you save the quote. This flag will allow Magento auto calculate the tax based on your shipping address. This article will guide you do it https://jamersan.com/magento-setting-order-quotes-tax-rate-based-on-shipping/


I have found that tax works only when you set 'region_id' in shipping address, and not with just 'region'.

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.