I need to apply free shipping rate to a quote on the fly, once some condition is met. This condition can change when subtotal changes or user logs in/out. Once applied I'd like it to persist from cart to checkout.

I've been trying to set the shipping price from event observers that fire on:


I tired:

1) Unsetting shipping amount on $quote->getShippingAddress();


This doesn't work because grand total is not being updated.

2) Setting carrier config from the observer:

$store = Mage::app()->getStore($quote->getStoreId());
$carriers = Mage::getStoreConfig('carriers', $store);

foreach ($carriers as $carrierCode => $carrierConfig) {
    $store->setConfig("carriers/{$carrierCode}/price", $newPrice);

Does not work either.

3) Setting another config from the observer:

$store->setConfig("carriers/freeshipping/free_shipping_subtotal", $newSubtotal);

This nearly worked but not for all cases. E.g. when $newSubtotal = 15 and actual order subtotal was 14.70 free shipping was applied - what should not happen.

Is there any other way I could do this? Thanks!

Your Answer

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

Browse other questions tagged or ask your own question.