cancel
Showing results for 
Search instead for 
Did you mean: 

How to set init_amount inside observer

How to set init_amount inside observer

Hi. I need to set the init_amout of product added to cart. So I added one observer, but just can not figure out the right syntax or command to set the init_amount.  As you can see i tried to set to 22 using that syntax below, but no success. Can some one give me the path to get this right.

 

public function updatePrice($observer)
{
     $event = $observer->getEvent();
    $product = $event->getProduct();
    $quote_item = $event->getQuoteItem(); 
    $quote_item->setOriginalCustomPrice(10);
    $quote_item->product->recurring_profile->init_amount =  22;
    $quote_item->getQuote()->save();