Why does my plugin in etc/di.xml not fire on the storefront?
Categories:
Claude — Module Anatomy
You almost certainly put it in etc/frontend/di.xml when you needed it in etc/di.xml — or vice-versa. Magento has four DI scopes: etc/di.xml (global), etc/frontend/di.xml (storefront only), etc/adminhtml/di.xml (admin only), etc/webapi_rest/di.xml + webapi_soap/di.xml (REST/SOAP). Plugins on storefront-only services (e.g. CustomerSession) live under etc/frontend/. Plugins on universal services (e.g. OrderRepository) live in global etc/di.xml. Run bin/magento setup:di:compile after every move — the compiled interceptors are area-scoped and won't pick up the change otherwise.
Was this helpful?