I have an order data without shipping included, i tried to re-calculate total order when adding shipping price like this:

$shippingAmount = '30000';
$quote = $this->getQuote();
$quote->setGrandTotal($quote->getGrandTotal() + $shippingAmount);

but the above code won't recalculate total discount and tax


Once you set the Shipping method, you should tell magento to Collect Totals again. Refer below code:

$onepage = Mage::getSingleton('checkout/type_onepage');
$quote = $onepage->getQuote();
$shippingMethod = 'shipping_method_code';

The above code will work if you have a shipping method with code 'shipping_method_code' for the shipping address you selected. Read the tutorial to learn how to create a shipping method Here or use any existing shipping methods like USPS, UPS, Flat Rate etc.

| improve this answer | |
  • that makes my grand total 0 – Idham Choudry Dec 13 '17 at 12:24
  • Paste your code – Nidheesh Dec 13 '17 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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