Sometimes, when refreshing the Magento cart page for example, the cart items will disappear. The problem here might be a missing image. Check if there are any missing images on the cart page and if so, upload them to your…
Removing estimated shipping from cart (Magento 1)
To remove the estimated shipping block from the Magento cart, you have to add the below code, or, if the checkout_cart_index handle already exists, simply add the checkout.cart section to it.
1 2 3 4 5 6 7 |
<checkout_cart_index> <reference name="content"> <block name="checkout.cart"> <remove name="checkout.cart.shipping"/> </block> </reference> </checkout_cart_index> |
Removing items from cart programmatically (Magento 1)
Using the following code, you can remove an item from the Magento cart by item id:
1 2 3 |
$cartHelper = Mage::helper('checkout/cart'); $cartItemId = 123; $cartHelper->getCart()->removeItem($cartItemId)->save(); |
Getting the product for cart item (Magento 1)
Use the following code to get the matching product of a Magento cart item:
1 |
$product = $item->getProduct(); |