How to use of wishlist_add_product event in Magento 2?

Wishlist adds product events that will be used to define data after a successful item added to the wishlist.

If you want to trigger something once product added to wishlist or do some action after item added to the wishlist, you need to define "wishlist_add_product" in your events.xml file.

Create Observer Class to handle your logic after adding items to the wishlist. In the observer file, You got Product, Wishlist, and Current Item object, based on that you can retrieve/modify your logic.

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="wishlist_add_product">
        <observer name="marketing" instance="Jesadiya\WishlistAdd\Observer\WishlistAddItemObserver" />

You can define events.xml file in your frontend area.

Path: Jesadiya\WishlistAdd\Observer\WishlistAddItemObserver.php

namespace Jesadiya\WishlistAdd\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;

class WishlistAddItemObserver implements ObserverInterface
     * Add product to wishlist after action
     * @param Observer $observer
     * @return void
    public function execute(Observer $observer)
        /** Current Wishlist Object */
        $wishlist = $observer->getEvent()->getWishlist();
        /** Current Product Object */
        $product = $observer->getEvent()->getProduct();
        /** Current Magento\Wishlist\Model\Item Object */
        $item = $observer->getEvent()->getItem();


This event will be used after the item added to the wishlist successfully.

You can check the core definition from the Magento_Wishlist module, vendor/magento/module-wishlist/Controller/Index/Add.php

You can also refer to the core example from the Magento_Reports module,


You can also interested to learn A Complete List of all events in Magento 2.