cancel
Showing results for 
Search instead for 
Did you mean: 

Magento2 Cart Page/Mini Cart Issue

Magento2 Cart Page/Mini Cart Issue

Hi All,

When we add one product multiple times to cart , it is displaying as individual items rather than updating quantity as 2 or 3 or 4.

Lets take one example here. I have a product called as " Bean bag". I clicked on add to cart button . It is added to cart finely.

Again i came to Bean bag product and clicked on add to cart . Now also cart updated finely but in mini cart and cart page the product showing 2 times instead of updating quantity.

I am using porto theme in my website. Any solution for this?

Thanks
Dinesh

4 REPLIES 4

Re: Magento2 Cart Page/Mini Cart Issue

Hi @dineshprim'

 

okay i understand the problem you are facing !

 

But i have checked with vanila latest magento version and when i add same product again then its updating the Quantity instead of adding new product into the cart.

 

So here you might have issue with the porto theme - do one thing - change your theme from porto to Luma (Magento's default)  theme and then try - and let me know if the error is still same or not.

 

And if its updating the cart then you can raise a ticket on porto theme portal as they might help you in this case.

 

Hope it helps 

if issue solved,Click Kudos & Accept as Solution

Re: Magento2 Cart Page/Mini Cart Issue

Hi @dineshprim,

 

This could be due to a setting in the admin. Check Sales>Checkout>My Cart Link and check if the setting is set to "Display Item Quantities".

 

Re: Magento2 Cart Page/Mini Cart Issue

Hi ,

Thanks for your reply. I found the issue in one of the module called as GST. In that module they written one observer. code is like this

 

public function execute(\Magento\Framework\Event\Observer $observer)
    { 

        $quote = $observer->getEvent()->getQuote();
        //$quote_items = $quote->getItemsCollection();
        $quoteItem = $observer->getQuoteItem();
        
        $vProducts = $this->_objectManager->create('Ced\CsMarketplace\Model\Vproducts');
        
        
            
        $item = $observer->getQuoteItem();
        $product = $item->getProduct();
        
        $productData = $this->_objectManager->create('Magento\Catalog\Model\Product')->load($item->getProductId());
        if($vendorId = $vProducts->getVendorIdByProduct($item->getProductId())) {
            $item->setVendorId($vendorId);
            if($product->getTypeId()=='configurable') {
            	return $this;
            }
            $vendor = $this->_objectManager->get('My\Marketplace\Model\Vendor')->load($vendorId);
            $publicName = $vendor->getPublicName();
            $shopUrl = $vendor->getVendorShopUrl();
                
            $additionalOptions = array(
            		array(
            'code'  => 'my_code',
            'label'  => 'Vendor',
            'value' => $publicName
            ),
            		array(
            				'code'  => 'hsncode',
            				'label'  => 'HSN Code',
            				'value' => $productData->getHsn()
            		),
            );
            
            $item->addOption(
                array(
                'product' => $item->getProduct(),
                'code' => 'additional_options',
                'value' => json_encode($additionalOptions),
                )
            );
        }else{

        	$additionalOptions = array(
        			
        			array(
        					'code'  => 'hsncode',
        					'label'  => 'HSN Code',
        					'value' => $productData->getHsn()
        			),
        	);
        	
        	$item->addOption(
        			array(
        					'product_id' => $item->getProductId(),
        					'code' => 'additional_options',
        					'value' => json_encode($additionalOptions),
        			)
        	);
        	
        }    
                
                

    }

When i disabled this module everything is working fine. But when i enabled it problem comes. Any code changes suggested to above?

 

Re: Magento2 Cart Page/Mini Cart Issue

I would say contact the module developer with your problem, since it seems like that is causing the issue.