I want to keep items in wishlist when user click "add all to cart" button. Have any idea how to fix it?
Magento – Magento 2 – Don’t want to remove wishlist items when click ‘Add all to cart’ button
addtocartmagento2wishlist
addtocartmagento2wishlist
I want to keep items in wishlist when user click "add all to cart" button. Have any idea how to fix it?
Best Answer
Magento adds wishlist items to the cart using the
addToCart()
method on the wishlistItem
class. This method has a parameter that specifies whether to also remove the item from the wishlist. You can add a plugin to this to force this parameter to always be false.Add this to a custom module
di.xml
, replacingNamespace\Module
with your module name:Then add this plugin to your module: