Showing posts with label How to Programmatically delete custom options on shoping cart magento. Show all posts
Showing posts with label How to Programmatically delete custom options on shoping cart magento. Show all posts

Tuesday, 18 August 2015

Remove custom options shopping cart page magento


Remove custom options shopping cart page magento

Customers can remove custom options which assigned to product while purchase product. Put below code in your template/checkout/cart/item/default.phtml file

<div class="add_btn l">
 <a href="<?php echo $this->getUrl('checkout/cart/'); ?>?id=<?php echo $_item->getId(); ?>"><span class="remove_icon l"></span>REMOVE OPTIONS</a>
</div>

if($_item->getOptions() != ''){
    foreach ($_item->getOptions() as $opt)
    {
        if($_item->getId() == $_REQUEST['id'])
        {
            $opt->delete();
            Mage::app()->getResponse()->setRedirect($this->getUrl('checkout/cart'));
        }
    }
    $_item->setHasOptions(0)->save();
 }

Thats it enjoy chandresh rana coding... :)