Open BassemN opened 3 years ago
Hi @BassemN. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
Hi @BassemN! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team
command to join Contributors team.
@BassemN stacked with same problem. For me helped to override class with preference Magento\Wishlist\Model\Wishlist and change getItemCollection function to:
public function getItemCollection()
{
return parent::getItemCollection()->load();
}
Point is to add load()
function when creating collection with filters.
@minenkoden Many thanks. This code fixed the issue. Thanks again :+1:
Preconditions
Steps to reproduce
Expected result
Adding products to the wishlist should work without any errors
Actual result
After clicking on "Add to wishlist", I'm getting this error
(Exception): Item (Magento\Wishlist\Model\Item) with the same ID "9980" already exists.
Additional notes
There is an already opened issue on the Magento main repo https://github.com/magento/magento2/issues/27137 but I opened this issue here because I got this error after migrating from M1
I also tried to truncate these tables
wishlist
,wishlist_item
&wishlist_item_option
and I got the same errorException #0 (Exception): Item (Magento\Wishlist\Model\Item) with the same ID "1" already exists.