5

I have an issue in Magento 2.1.6. When I add the same product in cart it's adding as a new line not update Qty of product. The same issue in the mini cart also.

Actual Result: Add as a separate product.

Expected Result: Update Qty if exist same product.

Mini Cart

Cart Page

4

3 Answers 3

0

I'm not sure for this issue but in my case I have a custom code running on the minicart

<preference for="\Magento\Checkout\CustomerData\Cart" type="\Vendor\QuickCart\Model\CustomerData\Cart"/>

In my case I'm extending the method getSortedCartItems and doing my own work in there.

So either the issue comes form a custom code broken there either you can analyse the getSortedCartItems from Magento Checkout and see what is happening.

Worst case scenario you can always extend the method to clean the returned array by yourself...even if for sure that's not the best solution.

0

You need to check this file in core or overrated in your modules.

vendor/magento/module-quote/Model/Quote/Item.php

Please check and debug this function representProduct() responsible for merging and adding new items to the cart.

0

Maybe you are adding some custom option so that product becomes differen.

In magento if you pass some custom option to the add to card process, it adds new quote item in the database.

Check if some custom module make changes to the cart process with plugin or observer. Try disabling custom modules to see is this problem persist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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