Just like the title says I want to change the price of the item before it hits the cart. A customer configures an item before purchasing and different combinations equal different prices. As a result I need to change the price of that specific (red shirt) not all red shirts! Which should be related to quote item I believe.

I have a variable constantly updating that represents the new price while they are configuring their item. Is there a way to pass this variable if it's stored in an ID and update the price for that quote item to the value of that ID before adding to the cart?

Let me know if there is anything I can clarify! Similar to this: https://stackoverflow.com/questions/30048776/how-to-change-the-price-before-adding-to-cart-in-magento

But I want to use the variable I have and set the price to that!

  • You are use the configurable product ?
    – Rajan Soni
    Nov 16 '16 at 5:19
  • I use configurable products but we add simple ones to the cart, so I would be adding simple products with updated prices to the cart Nov 16 '16 at 19:24

Create observer and implement below code:

Xml File etc/config.xml


Php File : Model/Observer.php

    class vendorName_PackageName_Model_Observer
        public function modifyPrice(Varien_Event_Observer $obs ){
        // Get the quote item

            $quote = $obs->getEvent()->getQuote();
            $item = $obs->getQuoteItem();

            Mage::log('My log entry', null, 'mylogfile.log');

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

  • Yes great. Correct & working one :) Thank you.
    – KA9
    Dec 31 '16 at 11:09

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.