I would like to customize the add to wish list functionality from my custom module In magento 2.
Actually i need custom options chosen and product id when i wishlist a product. i have found a link for list of magento 2 events below https://cyrillschumacher.com/magento2-list-of-all-dispatched-events/ please suggest me how to achieve this?
I have written code as shown below the event has been calling perfect but i unable to get the product id and custom options how to get in the observer?
app/code/Demo/Pricecalculations/etc/frontend/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="wishlist_add_product">
<observer name="Demo_Pricecalculations_Wishlistproduct" instance="Demo\Pricecalculations\Observer\Wishlistproduct" />
</event>
</config>
app/code/Demo/Pricecalculations/Observer/
<?php
namespace Demo\Pricecalculations\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;
class Wishlistproduct implements \Magento\Framework\Event\ObserverInterface
{
public function execute(\Magento\Framework\Event\Observer $observer)
{
$writer = new \Zend\Log\Writer\Stream(BP.'/var/log/Wishlist.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info("custom Wishlist function has been Calling");
}
}