I want to change each and every selected bundle items price on addtocart

How can I do this.

At present I am doing like below :

$item = $observer->getQuoteItem();
if ($item->getParentItem()) {$item = $item->getParentItem();}

By doing above, it only change Parent Bundle product Price.

Please check screenshot :

enter image description here

So is there any posibility to change price of bundle items with custom price which will display properly even after order place in order view page. I have go through the code and find that "Bundle Items's" price are saved in infobuyrequest.

$sel_bundle_options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());

So is it possible to change price directly into that ? But after placing an order if we check on order view pages,it will display.

  • I would recommend using a total model instead of wasting time on editing the buyrequest.
    – adjco
    Oct 6, 2016 at 21:48
  • Can you please elaborate ?
    – Krupali
    Oct 7, 2016 at 5:22
  • Can someone Please help on this issue? Mar 21, 2017 at 18:09
  • @MagentoTeam please look my answer.
    – Krupali
    Apr 4, 2017 at 11:33

1 Answer 1


You can do below code while adding product to the cart.

$cart = Mage::helper('checkout/cart')->getCart()->getQuote()->getAllItems();
$price = '';
foreach ($cart as $i)
  if ($i->getId() == '') // Dont getting id for currently adding bundle item.
     $options = $i->getOptions();
     foreach ($options as $option)
        if ($option->getCode() == 'bundle_selection_attributes')
           $unserialized = unserialize($option->getValue());
           $price = 10; // YOUR CUSTOM PRICE
           $unserialized['price'] = number_format($price, 2, '.', ',');
     catch (Exception $e)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.