Plugin in Magento 2

A plugin is a class that modifies the behavior of public class functions by intercepting a function call and running code before, after, or around that function call. This allows you to substitute or extend the behavior of original, public methods for any class or interface.

There are three types of plugin.
1. Before
2. After
3. Around