2

My requirement is to set a custom price for a bundle product in cart. Whatever its sub items may be.

Suppose I want to set $5 for a bundle product with 2 of its subitems. I am tracking checkout_cart_product_add_after this event.

And the function in Observer.php is as follows :

public function change_price(Varient_Event_Observer $observer) {

        $new_price = 5.00;      

        $item = $observer->getEvent()->getQuoteItem();

        $item->setCustomPrice($new_price);
        $item->setOriginalCustomPrice($new_price);
        $item->getProduct()->setIsSuperMode(true);
}

But, it is adding the first subitem's price with my custom price in cart. Say, first subitem price is $3. So the unit price becomes $8, instead I want only $5 as unit price.

Please help me how to get rid of this.

Mauker
  • 11,237
  • 7
  • 58
  • 76

0 Answers0