How to Enable or Disable Modules in Magento 2
Magento 2 Enabling and Disabling module is the popular action when you run third-party modules on your Magento 2 store. The third-party modules are often the plugins you want to enable with the main purpose to improve the status of your online business. However, due to any reason that sometimes causes the conflict when you activate all modules at the same time, it is necessary to disable the module that is not temporarily important.
So as to enable or disable, you can go into the configuration of that module, but on the topic today, Mageplaza will recommend you how to enable or disable Magento 2 module manually? That maybe will be great for the developers.
4 Step to enabling/ disabling Magento 2 module
- Step 1: Login to Magento File System
- Step 2: Run Magento commands
- Step 3: Enable/ Disable Magento 2 module
- Step 4: Update the database of Magento 2 enabled module
Step 1: Login to Magento File System
Firstly, it is required to login to Magento File System as an owner who has rights to write and edit the file system in Magento. In a case you use the bash shell, running the following command will help you access Magento File System as the owner
su <Magento file system owner> -s /bin/bash -c
If Magento File System does not accept any external login, please use the command below:
sudo -u <Magento file system owner>
Step 2: Run Magento commands
To run Magento commands from any directory, add
<your Magento install dir>/bin to your system
<your Magento install dir>/bin to your system
PATH or follow this intructions:
cd <your Magento install dir>/binand run them as
./magento <command name>
php <your Magento install dir>/bin/magento <command name>
<your Magento install dir> is a subdirectory of your web server’s docroot.
Step 3: Enable/ Disable Magento 2 module
Next, you can start to enable or disable the modules in Magento 2 as the following:
Run the commands
magento module:enable [-c|--clear-static-content] [-f|--force] [--all] <module-list> magento module:disable [-c|--clear-static-content] [-f|--force] [--all] <module-list>
With these commands, you need to understand:
<module-list>is the modules list that you want to enable or disable. If including the special characters, that module’s name will be put in either single or double quotes.
--allmentions you can simultaneously enable or disable all modules.
--forcemeans you obligate to enable or disable the modules regardless the dependencies.
--clear-static-contentmeans clear any published static view files. However, if there are many files having the same name, you will not eliminate all of them. That means there is more than one file named logo.gif and that will cause the mistake to display the file.
Show the list of the enabled and disabled modules with the command:
For example, you call Wee module that is disabled, need to run
magento module:disable Magento_Weee
Step 4: Update the database of Magento 2 enabled module
After enabling one or more modules, should declare the following command to request the update of the database:
Notes of enabling and disabling Magento 2 module
Here are some notes for you when you enable or disable the module which has the dependencies on another module.
- If Module A depends on Module B:
- It is required to disable Module A before disabling Module B.
- It is required to enable Module B before enabling Module A if both are unavailable.
- If Module A conflicts with Module B, you can disable both of them or do that individually, but especially, you cannot enable both at the same time.
The dependencies are announced in the
require field in the Magento’s
composer.json file of each module while the conflicts are announced in the
conflict field. If there are dependencies among the modules, and you still try to enable and disable without the rule, the error message will be shown and inform of you the dependency graph.
- A->B means Module A depends on Module B.
- A->B->C means Module A depends Module B while Module B depends on Module C.
You’ll need to disable a module run a module in Magento 2 because there are modules that conflict with each other. You can easily do it with this tutorial. If you find it helpful, don’t forget to share it with your friends. Thanks for reading!
- How to create a simple Hello World module for Magento 2
- Magento 2 Block Template Ultimate Guides
- How to Create Module in Magento 2
- How to Create Controller in Magento 2
- How to create CRUD Models in Magento 2
- View: Layouts, Block and Templates
- Configuration - System.xml
- How To Create Admin Menu In Magento 2
- Admin ACL
Enjoyed the tutorial? Spread it to your friends!
Sam is the CEO and Founder of Mageplaza, pursuing a simple and healthy lifestyle. He is a friend, a husband, and a father to two children. As a trainer and an aspiring influencer, he is also a big fan of sports and travel. Sam is exceptionally knowledgeable about e-commerce, especially Magento and Shopify, with 10 years of experience in the field.
People also searched for
- Magento 2 disable module
- magento 2 enable disable module
- magento 2 disable module from database
- magento 2 disable module from code
- magento 2 disable module for store
- magento 2 disable module from admin
- magento 2 disable module in database
- magento 2 disable module in xml
- magento 2 disable module in admin
- magento 2 disable module manually
- magento 2 disable module mysql
- magento 2 disable module output
- magento 2 disable modules output not working
- magento 2 disable module programmatically
- magento 2 disable module per store
- magento 2 disable modules performance
- magento 2 disable module via database
- magento 2 disable module xml
- 2.2.x, 2.3.x, 2.4.x