Don't want remove wishlist items when click 'Add all to cart' button - magento

Don't want remove wishlist items when click 'Add all to cart' button - magento

September 30, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Don't want remove wishlist items when click 'Add all to cart' button - magento

Keeping Wishlist Items After Adding All to Cart in Magento

If you’re looking to keep your wishlist items intact even after clicking “Add all to cart,” you’ve come to the right place. In this post, we’ll troubleshoot a common issue and provide a step-by-step solution.

Understanding the Issue

When you modify the code as suggested in this forum discussion, it works for individual items added to the cart. However, if you use the “Add all to cart” button, all wishlist items will still be deleted.

The reason behind this behavior is that when adding multiple items at once, Magento’s core functionality triggers a different delete action in the Mage_Wishlist_Model_Item class.

The Current Approach: Commenting Out Lines

You mentioned trying to comment out $item->delete(); in app/code/core/Mage/Wishlist/Controller/Abstract.php. While this might seem like a logical approach, it doesn’t solve the underlying issue. This line is responsible for deleting items from the wishlist only when an item is moved or removed individually.

To resolve this, we need to dig deeper into the Magento core and modify the logic that handles bulk additions to the cart.

The Effective Solution

Open app/code/core/Mage/Wishlist/Model/Item.php and locate the method moveToCart().

In this method, you’ll find a section of code responsible for deleting an item from the wishlist after adding it to the cart. However, there’s no specific condition to check if the “Add all to cart” button was used.

if (isset($itemId)) {
    $this->deleteItem((int)$itemId);
}

This line simply deletes the item without any checks. To keep items on the wishlist, we need to add a new condition that prevents deletion when adding multiple items at once.

Modifying the Core Code

Replace the above code with this modified version:

if (isset($itemId)) {
    if ($this->getWishlist()->getAddAllToCart()) {
        $this->deleteItem((int)$itemId);
    }
}

Here, we’re checking if the wishlist has triggered the “Add all to cart” action. The getAddAllToCart() method returns a boolean value indicating whether this flag is set.

Now, only when adding individual items will they be deleted from the wishlist. For bulk additions, the items will remain on your wishlist as desired.

Final Thoughts

Keeping wishlist items intact after using the “Add all to cart” feature requires a deep understanding of Magento’s core functionality. By modifying the moveToCart() method in the Mage_Wishlist_Model_Item class, we can effectively change this behavior.

Remember, modifying core files should always be done with caution and is not recommended for production sites unless necessary. It’s always best to create a local development environment or use Magento 2’s extension architecture for custom functionality.

I hope this guide helps you resolve the issue! Let me know if you have any other questions about Magento development.

For more tips on Magento customization and development, be sure to check out our Magento Development category at LaravelCompany.

Checkout Errors CLI

Our network