cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix "Cannot add the item to shopping cart" error?

SOLVED

How to fix "Cannot add the item to shopping cart" error?

    $item = $observer->getEvent()->getQuoteItem();
    
    $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
       
    $_product = Mage::getModel('catalog/product')->load($item->getProductId()); 
    
    $finalPrice = $Customprice + $_product->getPrice();
    
    $item->setCustomPrice($finalPrice);
    $item->setOriginalCustomPrice($finalPrice);
    $item->getProduct()->setIsSuperMode(true);
    $item->save();

After that when customer as guest logged in and customer add to cart any of the product at that time display the error like:

"Cannot add the item to shopping cart" 

How to fix this error?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to fix "Cannot add the item to shopping cart" error?

Hi,

 

try to remove the last line "$item->save()"

this can make problems when it`s about a guest customer. 

Magento Senior Developer (Freelancer).
Contact: siegfriedschmitz@me.com

View solution in original post

2 REPLIES 2

Re: How to fix "Cannot add the item to shopping cart" error?

To see the root problem, share the last error message from /var/log/exception.log file. 

-- Ravindra

Re: How to fix "Cannot add the item to shopping cart" error?

Hi,

 

try to remove the last line "$item->save()"

this can make problems when it`s about a guest customer. 

Magento Senior Developer (Freelancer).
Contact: siegfriedschmitz@me.com