i try to remove a product from Cart by Sku - is it possible?
I tried the following Code in cartcontroller.php but without success ....
I know it should work by ID but by Sku would be easier for me.
$session = Mage::getSingleton('checkout/session');
$quote = $session->getQuote();
$cart = Mage::getModel('checkout/cart');
$cartItems = $cart->getItems();
foreach($cartItems as $item) {
if ($item->getSku() == promo){
$quote->removeItem($item->getId())->save();
}
}
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
$cart->init();