O'Reilly logo

Magento 2 Developer's Guide by Branko Ajzele

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Plugins

In this chapter, we will take a look at a feature of Magento called plugins. Before we start with plugins, we first need to understand the term interception because the two terms are used somewhat interchangeably when dealing with Magento.

Interception is a software design pattern that is used when we want to insert code dynamically without necessarily changing the original class behavior. This works by dynamically inserting code between the calling code and the target object.

The interception pattern in Magento is implemented via plugins. They provide the before, after, and around listeners, which help us extend the observed method behavior.

In this chapter, we will cover the following topics:

  • Creating a plugin
  • Using the before ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required