Save custom data to ('checktout/session') when product added to cart and remove when removed So i need to add custom data for each product when customer adds it to card and remove it when customer removes from cart. What i have done so far was creating observer that fires up when customer adds product to cart, but it doesnt save my data in global ('checkout/session').

In observer i can see my custom data saved.

This is the code in observer:

$quoteId = Mage::getSingleton('checkout/session')->getQuote()->getEntityId();
    $quote = Mage::getModel('sales/quote')->load($quoteId);

    $carDetails = Mage::getSingleton('core/session')->getCarDetails();
        $carDetails = 'No Car in Search';

    $quoteItems = $quote->getAllItems();

    foreach ($quoteItems as $quoteItem){

        $product = $quoteItem->getProduct();

        $quoteItems = $product->setCarDetails($carDetails);

New contributor
pagani is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

pagani is a new contributor. Be nice, and check out our Code of Conduct.

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

Browse other questions tagged or ask your own question.