I want to keep items in wishlist when user click "add all to cart" button. Have any idea how to fix it?

3 Answers 3


Magento adds wishlist items to the cart using the addToCart() method on the wishlist Item 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, replacing Namespace\Module with your module name:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Wishlist\Model\Item">
        <plugin name="keep_in_wishlist" type="Namespace\Module\Plugin\KeepItemsInWishlistOnPurchase" />

Then add this plugin to your module:

namespace Namespace\Module\Plugin;

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

class KeepItemsInWishlistOnPurchase
     * @param \Magento\Wishlist\Model\Item $item
     * @param \Magento\Checkout\Model\Cart $cart
     * @return array
    public function beforeAddToCart(Item $item, Cart $cart)
        return [$cart, false];

AS OF NOW 18 JAN 2020 this observer is not useful, please have a look on @scotts's answer

This is Magento's default functionality, when a product is added to cart it it removed from the wishlist.

You can update this functionality in observer vendor/magento/module-wishlist/Observer/AddToCart.php

which is triggered by checkout_cart_add_product_complete event in vendor/magento/module-checkout/Controller/Cart/Add.php controller.

To stop products removal from wishlist you have to disable this core observer by following way.

Your custom-module's Vendor/Module/etc/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_cart_add_product_complete">
        <observer name="wishlist" disabled="true"/>
  • 1
    This will not work because this observer no longer does anything. It is a deprecated holdover from Magento 1, and old Magento 1 at that. It handles requests to the standard add-to-cart controller (different from the regular wishlist add-to-cart controller) that include the wishlist_next URL parameter, which per this answer was removed in Magento 1.4: magento.stackexchange.com/a/253200/567 Commented Jan 17, 2020 at 18:00
  • @ScottBuchanan Thanks for the update...
    – Knight017
    Commented Jan 18, 2020 at 10:07

Please check this extension that matches your ask https://marketplace.magento.com/decryptweb-wishlist.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.