Hi I was trying to remove an item from the sales quote item.
$quoteItemCollection = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('quote_id', $quoteId)->addFieldToFilter('product_id', $product_id)->getFirstItem();;
$itemId = $quoteItemCollection->getItemId();
$quoteItemCollection->removeItem($itemId);
$quoteItemCollection->save();
This is returning me the following error.
{"messages":{"error":[{"code":0,"message":"Invalid method
Mage_Sales_Model_Quote_Item::removeItem(Array\n(\n [0] =>
1355\n)\n)"}]}}
If this is not the way,is there any other way to do or what made me wrong here.Please help.
Best Answer
try below code because
save
method doesnot work withcollection
removeItem method code