Magento 2 Enable and Disable module is a popular activity when you run third-party modules on your Magento 2 store. Third party modules are usually the plugins or extensions you want to activate with the primary purpose of improving your online business status. However, for some reason sometimes causing conflict when you activate all modules at the same time, you need to select and disable the temporary module does not matter to fix the problem.

So as to enable or disable, you can go to the configuration of that module, but today I will guide you to enable or disable Magento 2 module manually. That would be great for developers.

Overview of enable and disable modules

  • 1: Log on to the Magento File System
  • 2: Run the Magento command
  • 3: Magento module 2 enable/disable
  • 4: Update the database

1: Login to Magento File System

Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner. If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:

If the Magento file system owner does not allow logins you can do the following

2: Run Magento commands

To run Magento commands from any directory, add

  • <your Magento install dir>/bin

to your system PATH.

Please inject <your Magento install dir>/bin to your system PATH or follow this instruction:

  • cd <your Magento install dir>/bin and 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 doc root.

3. Module enable, disable

To enable or disable available modules, use the following command:

With these commands, you need to understand:

  • <module-list> is a space-delimited list of modules to enable or disable. If any module name contains special characters, enclose the name in either single or double quotes.
  • –all to enable or disable all modules at the same time.
  • -f or –force to force a module to be enabled or disabled despite dependencies.
  • -c or –clear-static-content means clear any published static view files

Use the following command to list enabled and disabled modules:

For example, to disable the Weee module, enter:

4. Update the database

If you enabled one or more modules, run the following command to update the database:

Some note about enable and disable modules

Magento allows you to enable or disable existing modules

Some modules depend on other modules, in which case you can not enable or disable a module as it depends on other modules.

In addition, there might be conflicting modules that cannot both be enabled at the same time.


  • Module A is dependent on Module B. You can not disable Module B unless you disable Module A.
  • Module A is dependent on Module B, both of which are disabled. You must turn on module B before you can enable module A.
  • Module A conflicts with Module B. You can disable Module A and Module B. Or you can disable one of the two modules, but you can not turn on Module A and Module B at the same time.

Dependencies are declared in the required field in Magento’s composer.json file for each module. Conflicts are declared in the conflict field in modules’ composer.json files. We use that information to build a dependency graph:

  • A-> B means module A depends on module B.
  • A dependency string is the path from module to module. For example, if module A depends on module B and module B depends on module C, the dependent sequence is A-> B-> C.

If you try to enable or disable a module that depends on other modules, the dependency diagram graph displayed in the error message.

Command line module enable or disable subcommand only: To force a module to be enabled or disabled regardless of its dependencies, use the optional –force argument.

Leave A Comment?

You must be logged in to post a comment.