I have the following requirement for a shipping module in Magento: on the shipping method step on one page checkout in Magento, the user should be able to add additional options to a particular method (are there any fragile items, pick up from warehouse, add insurance etc.). Based on that, I have to recalculate shipping costs. In essence, I need to get the submitted options, make an API call, and represent the new costs to the user. Currently I have overriden Checkout_OnepageController successfully. How can I repeat that step?


1 Answer 1


You can recalculate totals by using collectTotals() method in app/code/core/Mage/Sales/Model/Quote/Address.php by getting the quote. For example:



  • Thanks for the quick answer Marceli, but i need to add to the costs to the shipping methods alone.Basically i need to add some costs in collectRates method in the custom carrier object.To do that i will use the parameters submitted in the $_POST array and then redisplay the new values to the customer, but in order to do that i need to submit co-shipping-method-form first (via additional button).
    – Evgeni Ivanov
    Mar 6, 2013 at 14:47
  • 1
    Check collectShippingRates() method in the same file maybe this will help you.
    – Marceli Po
    Mar 6, 2013 at 14:54
  • Yes, i am just playing with this method.It seems that there is no other way to achieve what i want.Thank again Marceli!
    – Evgeni Ivanov
    Mar 6, 2013 at 15:32

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.