I have developed A custom module using event observer method, In that I am updating Handling fee(15%) for the customers that reside outside USA. I can see that this code is updating the carrier's shipping fee correctly but that change is not reflected in the grand total. i.e the shipping fee cost added to the grand total is set according to the one set in admin panel(8%).

I want to update this grand total using the updated shipping and handling fee. How can i achieve that?


<?xml version="1.0" ?>
        <version>0.1.0</version>    <!-- Version number of your module -->


class Dynamo_HandleFee_Model_Observer


public function customerAddressSaveAfter(Varien_Event_Observer $observer)

        /**@var Mage_Sales_Model_Quote $quote */
        $quote = $observer->getQuote();
        $countryId = $quote->getShippingAddress()->getCountryId();
        $someConditions = true; //this can be any condition based on your requirements
        $newHandlingFee = 15;
        $store    = Mage::app()->getStore($quote->getStoreId());
        $carriers = Mage::getStoreConfig('carriers', $store);
        foreach ($carriers as $carrierCode => $carrierConfig) {

            if($carrierCode == 'pickup'){
                if($countryId != 'US' ){

                    $carrierConfig['handling_fee'] = 15;
                    $store->setConfig("carriers/{$carrierCode}/handling_fee", $newHandlingFee);


            //echo true;exit;

                            //echo  Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal();


1 Answer 1


As it turns out i was hooking up a different event to update the Handling Fee. Instead of sales_quote_save_before event, I used sales_quote_collect_totals_before event and it worked like a charm. Any one like me who doesn't know when these events are fired or want to know more about them, This answer really helped me understand these events.

Your Answer

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

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