Skip to content

Magento: Clear Everything in The Cart

this is the way how to clear everything in the cart, clear the items & cart session,

$cartHelper = Mage::helper(‘checkout/cart’);

$items = $cartHelper->getCart()->getItems();

foreach ($items as $item) {
$itemId = $item->getItemId();

$cartHelper->getCart()->removeItem($itemId)->save();
}

Mage::getSingleton(‘checkout/session’)->clear();
Mage::getSingleton(‘checkout/cart’)->truncate();

Maknyos!!!

Share

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.