After changing price Rs.31078 how to add it to the cart.

How to get the price dynamically?

$quote = $observer->getEvent()->getQuote();
            $item = $observer->getQuoteItem();
            // echo"<pre>";
            // print_r($_product);
            // exit();
            $newprice=$_product->getPrice();-->i need 31078  product change price.

            // ****** But in cart i am getting 15128. ? ******

            // Set the custom price
            // Enable super mode on the product.

this is the change price ,i need to add to cart . But in my cart its taking admin panel product price enter image description here

enter image description here


You need to create observer with "checkout_cart_product_add_after" event.

after that in your observer file use below function.

public function customPrice(Varien_Event_Observer $observer)
    /* @var $item Mage_Sales_Model_Quote_Item */
        $item = $observer->getQuoteItem();

        $specialPrice = 5;

  • its not a special price. how to set the price? – Suma J Aug 24 '17 at 6:27
  • $quote = $observer->getEvent()->getQuote(); $item = $observer->getQuoteItem(); $product_id=$item->getProductId(); $_product=Mage::getModel('catalog/product')->load($product_id); $newprice=$_product->getPrice();------------->i need Rs 31078,but in cart i am getting check screen shot $item->setCustomPrice($newprice); $item->setOriginalCustomPrice($newprice); $item->setFinalPrice($newprice); // Enable super mode on the product. $item->getProduct()->setIsSuperMode(true); – Suma J Aug 24 '17 at 6:29
  • how to set price dynamically $newprice=$_product->getPrice();-- – Suma J Aug 26 '17 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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