- I have one Observer in my custom module.
- I want to create Plugin for that observer.
How can I achieve that ?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityYou can right controller or observer path in your di.xml file as per the syntax mention here :
<config>
<type name="{ObservedType}">
<plugin name="{pluginName}" type="{PluginClassName}" sortOrder="1" disabled="false"/>
</type>
</config>
Just add to di.xml your plugin.
<type name="Your\Observer\Namespace">
<plugin name="your_plugin_name" type="Your\Plugin\Class" />
</type>
Then you can create methods like beforeExecute afterExecute etc.