You should see in cart one product with qty 2:

You see in cart two exactly the same products in cart, each with qty 1:

@princeantil90 provided video for reproducing this issue https://nimb.ws/wcJX67
Please provide more concrete steps for reproducing because I got a merged quantity in my cart.
Precondition:
Magento CE 2.1 without sample data is installed.
Wishlist is set up
Steps to reproduce:
Logged user on frontend. Add one product to wishlist and from wishlist page add to cart. (NOTE: use button add to cart for single item. NOT ADD ALL TO CART).
Clear cookie or session id (SO LOGOUT USER ON FRONTENT) after logout go to category page and add same product to cart.
Login on frontend.
Expected result:
One row in quote_item table with merge quantity
Actual result:
In quote_item I have two row with same sku.
Can you upgrade to 2.1.3 and try to reproduce?
I tested it with 1.2.3 and 1.2.4, it does not work
Hey guys,
we have this bug in our System (Magento 2.1.2, PHP 7) too.
So i tried to figure out why this happens and stepped into the Magento Core.
During \Magento\Quote\Model\Quote->merge() Magento compares the quote items (to merge guest and customer quote) against each other.
The comparison between the two items happens on different steps:
In this case, the problem comes in step 3, because in here we have the option key "info_buyRequest" with different values.
In the item, which was added by wishlist:
$targetOptions['info_buyRequest'] = [
"item": "someItemId",
"product": "theproductid",
"originQty": "someOriginQty" // This is filled in \Magento\Wishlist\Model\Item->getBuyRequest()
];
In the item, which was added by default from category or detail page:
$comparedOptions['info_buyRequest'] = [
"product": "theproductid"
];

As you can see, the values differ and added the same quote items twice.
As far as i know, these options are for special cases like:
A really crappy solution to this problem is to comment out or remove the 3rd step of the compare function, but I don't know what is going to happen.
This is probably a Bug in Magento Wishlist.
@vlauria, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.1.9
@vlauria, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
I'm seeing this in 2.1.7.
@magento-engcom-team : Can we have a commit reference for the fix applied ?
Because on my side, if I add the same product to the cart multiple times in a very short delay, I get 2 same quote item row even if the stock quantity is 1.
Many thanks.
I have the same issue.
In a custom carrier class I am using the getAllItems method from the \Magento\Quote\Model\Quote\Address\RateRequest class and it returns duplicate items in the quote. Both items have the same sku and share almost the same proprieties but only one of them has the correct price info and the other the correct stock information.
This is :100: a bug and the ticked should be reopened and fixed.
Here are some screenshots:



Update
If you look in the Flatrate shipping class (line 108) this code skips the items that don't belong
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
continue;
}
I guess this can be used as a fix, but in my opinion items should not be added twice to the quote, the proprieties should be merged and only one should exist.
Seems like we have fix for this issue that was closed as can’t reproduce, also I see that there was added additional info that could help reproduce the issue.
Reopening this issue for confirmation that it still valid
I have the same issue.
- Magento 2.2.5
- PHP 7.1
In a custom carrier class I am using the
getAllItemsmethod from the\Magento\Quote\Model\Quote\Address\RateRequestclass and it returns duplicate items in the quote. Both items have the same sku and share almost the same proprieties but only one of them has the correct price info and the other the correct stock information.This is đź’Ż a bug and the ticked should be reopened and fixed.
Here are some screenshots:
Update
If you look in theFlatrateshipping class (line 108) this code skips the items that don't belongif ($item->getProduct()->isVirtual() || $item->getParentItem()) { continue; }I guess this can be used as a fix, but in my opinion items should not be added twice to the quote, the proprieties should be merged and only one should exist.
Hi @drew7721,
I just reviewed your screenshots and it looks like expected behavior.
When you have configurable product - you’re having in cart actually two products, one relates to “configurable” product, while other relates to “simple”. That’s needed for association that you bought this product from configurable. Also you could add the same product as a simple, in this case you’ll have only one. You could see that on your screenshots you have different product_id values for those 2 products.
Hi,
@princeantil90 provided following video to reproduce this issue:
https://nimb.ws/wcJX67
Hi @ihor-sviziev. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop branchDetails
- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.4-develop instance
Hi @ihor-sviziev. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @ihor-sviziev, here is your Magento instance.
Admin access: https://i-7679-2-4-develop.instances.magento-community.engineering/admin_1743
Login: e63c5858 Password: a24f6d9af8c6
Instance will be terminated in up to 3 hours.
Hi @princeantil90. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
2.4-develop branch@magento give me 2.4-develop instance to deploy test instance on Magento infrastructure. 2.4-develop branch, please, add the label Reproduced on 2.4.x.:white_check_mark: Confirmed by @ihor-sviziev
Thank you for verifying the issue. Based on the provided information internal tickets MC-33098 were created
Issue Available: @ihor-sviziev, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
@magento give me 2.4-develop instance
Hi @engcom-Kilo. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @engcom-Kilo, here is your Magento instance.
Admin access: https://i-7679-2-4-develop.instances.magento-community.engineering/admin_d6c1
Login: 50d1c56d Password: bc2a3313687e
Instance will be terminated in up to 3 hours.
Hi @vlauria,
We weren’t able to reproduce this issue on 2.4-develop branch anymore. More info https://github.com/magento/magento2/pull/27548#issuecomment-621819654
Following commit fixed this issue https://github.com/magento/magento2/commit/0621f4f5179b5a42c81c8ba7eac779d1b1efb0f3
Most helpful comment
Hey guys,
we have this bug in our System (Magento 2.1.2, PHP 7) too.
So i tried to figure out why this happens and stepped into the Magento Core.
During \Magento\Quote\Model\Quote->merge() Magento compares the quote items (to merge guest and customer quote) against each other.
The comparison between the two items happens on different steps:
In this case, the problem comes in step 3, because in here we have the option key "info_buyRequest" with different values.
In the item, which was added by wishlist:
In the item, which was added by default from category or detail page:
As you can see, the values differ and added the same quote items twice.
As far as i know, these options are for special cases like:
A really crappy solution to this problem is to comment out or remove the 3rd step of the compare function, but I don't know what is going to happen.
This is probably a Bug in Magento Wishlist.