In this tutorial we learn how to use plugin in magento 2.
In below code we create a plugin to make a ajax hit for newsletter subscription for users rest of all setting are same as default magento provides.

Di.xml

New Controller extended from Magento\Newsletter\Controller\Subscriber\NewAction

newsletter_subscripe.phtml (Override it for core newsletter_subscripe.phtml)

formsubmitnow.js file for Ajax request




Leave a Reply

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