Skip to content

Magento : Force Update Qty at Shopping Cart

it takes >30mins to discover this shit (sorry)

here you go

$cart = Mage::getModel(‘checkout/cart’)->getQuote();
foreach ($cart->getAllItems() as $item) {
$productName = $item->getName();
$sku = $item->getSku();
$qty_item= $item->getQty();

/*conditional if sku is blahblahblah the set qty to blahblah */
if($sku == ‘YOUR SKU’):
$item->setQty(1);
$item->save();
endif;
}

 

Share

Be First to Comment

Leave a Reply

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