I'm using Magento 2.3.4 , i tried to create a plugin for add to wishlist controller like this:
app/code/Vendor/All/etc/di.xml
<?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\Controller\Index\Add">
<plugin disabled="false" name="Vendor_All_Plugin_Magento_Wishlist_Controller_Index_Add" sortOrder="10" type="Vendor\All\Plugin\Magento\Wishlist\Controller\Index\Add"/>
</type>
</config>
app/code/Vendor/All/Plugin/Magento/Wishlist/Controller/Index/Add.php
namespace Vendor\All\Plugin\Magento\Wishlist\Controller\Index;
class Add
{
public function beforeExecute(
\Magento\Wishlist\Controller\Index\Add $subject
) {
die('success');
}
}
when i access this controller, the die function is not working and still doing the normal controller function