Magento 2 Enable Disable module

Magento 2 Enabling and Disabling module is the popular operations 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 sometime 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.

Overview of 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 PATH.

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

  • 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 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.

  • --all mentions you can simultaneously enable or disable all modules.

  • -f or --force means you obligate to enable or disable the modules regardless the dependencies.

  • -c or --clear-static-content means 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:

magento module:status

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:

magento setup:upgrade

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 the dependencies among the modules, and you still try to enable and disable without the rule, the error message will be shown and inform 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.


Next tutorial:

Module Development Series



Enjoyed the tutorial? Spread it to your friends!

magento-2-tutorial
enable
disable
module

Module Development

Comments for Magento 2 Enable Disable module

Please leave comments if you have any questions, feedbacks.

You also may like these Magento 2 Extensions

One Step Checkout

$199
10 reviews

Layered Navigation

$99
12 reviews

Magento 2 SEO

FREE
no review

Shop By Brand

$99
3 reviews

People also searched for:

  • Magento 2 disable module
  • magento 2 enable disable module
  • magento 2 isable module from database
  • magento 2 isable module from code
  • magento 2 isable module for store
  • magento 2 isable module from admin
  • magento 2 isable module in database
  • magento 2 isable module in xml
  • magento 2 isable module in admin
  • magento 2 isable module manually
  • magento 2 isable module mysql
  • magento 2 isable module output
  • magento 2 isable modules output not working
  • magento 2 isable module programmatically
  • magento 2 isable module per store
  • magento 2 isable modules performance
  • magento 2 isable module via database
  • magento 2 isable module xml