Magento 2.x Plugins

“A plugin or interceptor is a class that modifies or expand or edit the behavior of public class functions by intercepting a function call or set of code before, after or around that function call”

“Inserting code dynamically without changing original class behavior is called Plugin”

Plugins using design pattern “Interception”

Plugins Limitation : There are following below criteria where plugins can not used.

  • final classes
  • non public methods
  • static methods
  • constructor
  • virtual types
  • objects that are initialized before plugins loading

Plugins Types : There are three types plugins

  • Before listener Plugin (Before Plugin)
  • After listener Plugin (After Plugin)
  • Around listener Plugin (Around Plugin)

Leave a Reply

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