Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Creating Custom option and prize to just added product to cart using observer
 
keyurpatel90
Jr. Member
 
Total Posts:  4
Joined:  2013-02-18
 

I want to add custom option to quoteitem using observer which observer checkoutCartProductAddAfter event and fires after product added to cart.

public function checkoutCartProductAddAfter(Varien_Event_Observer $observer)
{

 $item 
$observer->getQuoteItem();  
  
$item->addOption(new Varien_Object(
            array(
                    
'product' => $item->getProduct(),
                    
'label' => 'Free Gifts',
                    
'value' => 'Spend $50 and get gift product worth $9.99'
                 
)
        ));
    return;

}
My observer is working but i am not able to add custom option to added product. please provide help to add custom option using
observer to just added product
also provide me to change product’s custom price in observer. i want to add custom price to zero. thanks in advance
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top