How to not remove items from Wishlist in Magento 2

Updates [April 20,2023] : I have developed an extension for this, please check details from link DW Wishlist Extension.

Magento 2 has a functionality that removes the item from wishlist if its added to cart from wishlist.

I had a task requirement, it was B2B project so mostly the vendors will buy the same set of products on a regular basis, so wishlist will act as reminder list, hence items should not be deleted from wishlist.

Explaining here the way to achieve this.

1) Define a plugin in your custom module’s di.xml

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Wishlist\Model\Item">
        <plugin name="retainWishlistItems" type="Namespace\Modulename\Plugin\RetainWishlistItems" />

2) Create a plugin

 * Namespace_Modulename

namespace Namespace\Modulename\Plugin;

use Magento\Checkout\Model\Cart;
use Magento\Wishlist\Model\Item;

class RetainWishlistItems
     * @param Item $item
     * @param Cart $cart
     * @return array
    public function beforeAddToCart(Item $item, Cart $cart) 
    	// Return delete item false after adding item from wishlist to cart
        return [$cart, false];

Hope it is helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top