Magento – Magento 2 : Use plugin / interceptor on abstract class

interceptormagento2plugin

I am trying to create a plugin that fires after \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShipment\PrintAction::execute.
So I have my plugin setup in di.xml and an afterExecute() method, but it doesn't seem to get fired.
Now I know there are some limitations for plugins, but I can't read anything about abstract classes.
Can plugins / interceptors be used on abstract classes?

Best Answer

Just to answer the real question here: Yes, it is indeed possible to define plugins / interceptors on abstract classes. Doing this works similar to other plugin definitions: An Interceptor class will be generated for each subclass of the abstract class.

Related Topic