4

When I add the product to the cart at the wishlist page, the product automatically removed from the wishlist and the product was no longer in the wishlist page. Is there a way to keep the product at a wishlist after adding the product to the cart?

2 Answers 2

0

Currently, I cannot find the best solution for this case. My idea is to disable wishlist event (and then we can create our custom event):

<event name="checkout_cart_add_product_complete">
    <observer name="wishlist" disabled="true"/>
</event>
5
0

Here are solution which can be solved your problem:

Note: Please Override below functions which i mentioned because of best practices :)

vendor/magento/module-checkout/Controller/Cart/Add.php

public function execute()
{
   /** Comment this event */
   /*$this->_eventManager->dispatch(
            'checkout_cart_add_product_complete',
            ['product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()]
        );*/ 
}

vendor/magento/module-wishlist/Controller/Index/Cart.php

/** Make this change */
$item->addToCart($this->cart, true);
To
$item->addToCart($this->cart, false);

Hope this can be helpful.

Happy coding :)

Thanks

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.