Is there any way to remove shipping method from quote, programmatically.

I have try this code


but not working.

And this code is remove only from the session. How can i remove from the quote table.

4 Answers 4


Try this code:


// Set the payment method

// Set the payment method
$quote->getPayment()->importData(array('method' => $paymentMethod));

// Collect the prices

you can do this

<?php $shippingaddress = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); ?>
<?php $shippingaddress->setShippingMethod(''); ?>
<?php $shippingaddress->save(); ?>

but magento will throw an error saying select shipping method.you need to set something

  • not working. :( May 30, 2014 at 11:40
  • for me its working.i had tested my code now. May 30, 2014 at 11:49
  • its clear form the session. But still in quote table. How can i remove that, without remove the product from cart. May 30, 2014 at 12:08

If all you want is to remove current contents of shipping address. You can try this (which worked for me)

     $shippingaddress = Mage::getSingleton('checkout/session')->getQuote()
$shippingaddresss = $quote->getShippingAddress();

Set ShippingMethod null or empty string, both does same thing. but i recommend you to use null. Hope it will works. if not please share your code. Thanks

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.