Skip to main content
Added link to Magento plugin documentation.
Source Link

Things to try when your plugins aren't being called.

Inserting die('loaded plugin') temporarily in your plugin and die('loaded method') in the original method (or using debugger breakpoints) is a good idea.

1: Clear the generated files (fast, good for a quick check if your module has already been registered with #2)

rm -rf generated/*

2: Clear all caches and generated dirs, and register new modules. (slow, but basically refreshes everything)

 php bin/magento setup:upgrade        

3: Regenerate the di code. (slow, but can find issues in your code that the other methods don't)

php bin/magento setup:di:compile
php bin/magento cache:flush

Usually, #1 works, if not, try #2, then #3. If none of those work, check that your module's di.xml lines up with your modules (in the original post, it seems to).

Double-check that filepaths correspond with class names, and that case matches.

Official documentation for plugins is here: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html

Things to try when your plugins aren't being called.

Inserting die('loaded plugin') temporarily in your plugin and die('loaded method') in the original method (or using debugger breakpoints) is a good idea.

1: Clear the generated files (fast, good for a quick check if your module has already been registered with #2)

rm -rf generated/*

2: Clear all caches and generated dirs, and register new modules. (slow, but basically refreshes everything)

 php bin/magento setup:upgrade        

3: Regenerate the di code. (slow, but can find issues in your code that the other methods don't)

php bin/magento setup:di:compile
php bin/magento cache:flush

Usually, #1 works, if not, try #2, then #3. If none of those work, check that your module's di.xml lines up with your modules (in the original post, it seems to).

Double-check that filepaths correspond with class names, and that case matches.

Things to try when your plugins aren't being called.

Inserting die('loaded plugin') temporarily in your plugin and die('loaded method') in the original method (or using debugger breakpoints) is a good idea.

1: Clear the generated files (fast, good for a quick check if your module has already been registered with #2)

rm -rf generated/*

2: Clear all caches and generated dirs, and register new modules. (slow, but basically refreshes everything)

 php bin/magento setup:upgrade        

3: Regenerate the di code. (slow, but can find issues in your code that the other methods don't)

php bin/magento setup:di:compile
php bin/magento cache:flush

Usually, #1 works, if not, try #2, then #3. If none of those work, check that your module's di.xml lines up with your modules (in the original post, it seems to).

Double-check that filepaths correspond with class names, and that case matches.

Official documentation for plugins is here: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html

Source Link

Things to try when your plugins aren't being called.

Inserting die('loaded plugin') temporarily in your plugin and die('loaded method') in the original method (or using debugger breakpoints) is a good idea.

1: Clear the generated files (fast, good for a quick check if your module has already been registered with #2)

rm -rf generated/*

2: Clear all caches and generated dirs, and register new modules. (slow, but basically refreshes everything)

 php bin/magento setup:upgrade        

3: Regenerate the di code. (slow, but can find issues in your code that the other methods don't)

php bin/magento setup:di:compile
php bin/magento cache:flush

Usually, #1 works, if not, try #2, then #3. If none of those work, check that your module's di.xml lines up with your modules (in the original post, it seems to).

Double-check that filepaths correspond with class names, and that case matches.