Magento 2 – Mass disable or enable modules
Enabling and disabling is often a bit boring, because you need to do it one by one. In this tutorial I show you ho to mass disable or enable modules. If you are a bit experienced on linux shell, this may be obvious for you, if not just follow ma examples.
Magento 2 – Mass disable or enable modules
I’ve already shown how to enable or disable Magento 2 modules. Sometimes you need to disable an amount of modules, for example if you have a problem, which may be caused by a custom module. 3rd party modules often comes in a bunch of modules. A base module from that vendor, a module for displaying ads for this vendor, sometimes a module for some Magento bugfixes (if you use an older version) and finally the module with requested functionality. Often they depend on each other, so it is impossible to disable only one of them. If you want to disable all modules of a certain vendor use:
1 | php bin/magento module:status | grep [VendorName] | grep -v List | grep -v None | grep -v -e '^$' | xargs php bin/magento module:disable |
For Amasty modules this looks as follows:
1 | php bin/magento module:status | grep Amasty_ | grep -v List | grep -v None | grep -v -e '^$'| xargs php bin/magento module:disable |
You may change module:disable to module:enable if you want to enable them again.
Conclusion
Thank you Linux shell! It is very easy to do many things in only one command. I showed how to mass enable or disable Magento 2 modules by a simple command.