I need to keep the wishlist items after the customer have added them to the cart.
Where is the actual removal being done in the code?
I'm trying to track the call, but gets lost in the post being made in Wishlist.php
in getAddAllToCartParams()
method.
Best Answer
In
app/code/Magento/Wishlist/Controller/Index/Cart.php
in theexecute()
method the following code is what adds the item to the cart and removes it from the wishlist:The
addToCart()
method is declared inapp/code/Magento/Wishlist/Model/Item.php
and the second parameter is what triggers the wishlist deletion. If you set it to false it won't delete the item from the wishlist:To avoid the auto delete behavior I suggest you create a plugin on the
app/code/Magento/Wishlist/Model/Item.php
class:Then in your
Plugin/DisableAutoDelete.php
file you can do: