I'm using Magento 2.3.4 , i tried to create a plugin for add to wishlist controller like this:


<?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"/>


namespace Vendor\All\Plugin\Magento\Wishlist\Controller\Index;

class Add
    public function beforeExecute(
        \Magento\Wishlist\Controller\Index\Add $subject
    ) {

when i access this controller, the die function is not working and still doing the normal controller function

1 Answer 1


You code seem well. Check comoposer.json.registration.php,etc/modules.xmlexits at on your module. This minimum files to create a module.

Also, check your module is enabled/not and checkout at app/etc/config.php.If it is not enabled then you need to enable module do setup upgrade, di compile

  • yes you are correct, i misspell the registration.php file name
    – Padawan
    May 25, 2020 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.