Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clear Magento cart and quote items
<?php
// Clear Magento cart and quote items
$cart = Mage::getModel('checkout/cart');
$cart->truncate()->save(); // remove all active items in cart page
$cart->init();
$session= Mage::getSingleton('checkout/session');
$quote = $session->getQuote();
$cart = Mage::getModel('checkout/cart');
$cartItems = $cart->getItems();
foreach ($cartItems as $item)
{
$quote->removeItem($item->getId())->save();
}
Mage::getSingleton('checkout/session')->clear();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.