Skip to content

How to create a plugin before the observer in Magento 2

Today, we will guide you on How to override observer using the plugin in Magento 2. if you want to create a plugin for observer then you can following below steps

Step 1: Create di file di.xml in the etc directory

we used the file: app/code/Dev/Testing/etc/di.xml

Step 2: Create Plugin file CreditMemoObserver.php in the Plugin/Observer directory

we used the file: app/code/Dev/Testing/Plugin/Observer/CreditMemoObserver.php

Now Run the cache flush command.

php bin/magento cache:flush

You need to run a command using SSh from the root of your Magento instance. If you want to more command list then refer our another post which Magento 2 useful commands lists.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link
Powered by Social Snap