We'll review a simple example of extending Magento functionality to give you an idea of what's involved and get you on your way. Magento 2.0 has introduced the concept of plugins that rely on dependency injection. While it's tempting to think of a plugin as interchangeable with extension or module, a plugin actually plays a significantly different role. It listens to any public method call on another object. As long as the class or method doesn't use the
final keyword, any class and any public method is fair game, including methods in your classes, third-party classes and Magento classes. That's pretty impressive!
Start by declaring the plugin in the
di.xml file, in the