Enable and disable modules in Magento 2 via CLI & Web Setup Wizard

Enable and Disable modules in Magento 2 Reading Time: 6 minutes
Share on Pinterest

Sometimes using Magento 2 will call for the need to either enable or disable modules after you install it. Perhaps you’re trying to debug an issue or simply have no particular need for a certain module at this point in time. Well in this video, I’ll show you 2 methods for enabling and disabling Magento 2 modules. One will be using the backend and one will be using the Command Line Interface.

Three things I’d like to mention before I start. Firstly, don’t forget to like and subscribe if you find this video or any other videos on the channel useful.

Secondly, just a few words of wisdom. I wouldn’t recommend disabling any modules if you’re not sure what you’re doing. And always make sure you backup your website and test in a Development environment before doing anything on your live website.

Thirdly, you’ll find a link to an article on my site that may contain additional notes plus commands you can copy and paste. The article link is in the description below.

Enable and disable modules with Web Setup Wizard

So the first method to enable and disable modules is probably the easiest and most accessible because it can be done from the backend of Magento using the Web Setup Wizard. And it also holds your hand by walking you through the process over several steps. So let’s do that now.

As you can see, I’m logged into the backend of Magento as an Admin. I can access the Web Setup Wizard from the System Menu near the bottom left.

After selecting the option, you will be greeted by 4 options. Note, that whilst navigating the Wizard, you may be prompted to enter your Public Access Key and Private Access Key. This is used to sync your Magento installation with your Magento Marketplace account. If you’re not sure how to generate those Keys, it’s super simple. Checkout my ‘How to install composer and download Magento 2’ video, where I go over this. I’ll add a link to that video in the description below.

So the option I want to choose to enable and disable modules is the Module Manager. When the page loads, it will look similar to this. In the first column, the green icon represents an enabled module and the red represents a disabled one. The last column allows us to carry out our actions for the module. The columns in between help to identify the module and it’s version.

Today, I’ve decided to disable the Signifyd Module. It’s a 3rd party service that was introduced to Magento a couple of updates ago, but I have no need for it.

I should note that not all Magento modules can be disabled, as other modules may depend on them. I just happened to do my research before attempting this.

Now that I’ve identified the module, I’m going to click on the ‘Select’ link the the ‘Actions’ column and press ‘Disable’.

This will now take me though a wizard. It’ll start checking my Magento setup and Server to ensure that my actions can be executed without any conflicts. As you can see, I’m good to go and now allows me to proceed to the next stage.

The second stage insists that I backup parts of my Magento installation before continuing. I don’t have to do this, but I’d always recommend at least a Database backup. So let’s go ahead and do this now.

It’s taken a few moments for the backup to run. But I can now proceed to the final stage, where I’m are presented with a final button labelled “Disable”. Pressing this will display the status of my request. A few moments later the Signifyd module is now disabled.

I can verify this one of 2 ways. The first would be to revisit the Module Manager. And scrolling to the Signifyd module now displays a red icon. The second way is by visiting the Orders Page. The column that used to be there is now gone.

To re-enable the module, just repeat those steps again. Note that when you enable a module, the last process will take a few moments longer because Magento needs to runs an extra step in the background to install it.

Why I prefer the Command Line Interface

Now that you’ve experienced the Web Setup Wizard, you might be wondering why you’d want to go through the hassle of carrying out the same steps using a Command Line Interface. Well, there’s probably many reasons. But there’s only really 2 main reasons why I prefer this method.

Web Setup Wizard is inaccessible

If the backend of Magento is inaccessible because of a misbehaving module, or the Web Setup Wizard isn’t functioning properly then you’ll need a way to disable or enable a module that doesn’t rely on accessing the backend.

Coincidently, at the time of recording this video the Module Manager in the Web Setup Wizard has actually been broken since version 2.2.4 due to a bug that Magento introduced in the patch. However, we should hopefully see a fix by version 2.2.6.

The only reason I was able to access it for this video, was by deploying a workaround. I’ll leave a link to the workaround in the article.

Command Line Interface is faster

My second reason is that I just find the Command Line Interface faster to use. Once you’ve become confident in navigating your server via SSH, you’ll find it more efficient to use. I know it’s not for everyone and sometimes speed does result in mistakes, but I just prefer it. This method also allows me to enable or disable modules in bulk.

Enable and disable modules with Command Line Interface

So to get started with the Command Line Interface, I’ll need to login to my web server via SSH. If you’re not sure on how to do that, then look out for a mini-series I’ll be releasing soon that will cover the basics of using a Command Line Interface. Alternatively, you can refer to your web hosts documentation.

Once connected, I need to navigate to my Magento root directory. The root directory of Magento will vary depending on your host or how you installed it. But you’ll know when you’re there, because using the command ‘ls -la’ will list a bunch of files in that directory that should closely resemble this. It’s also wise to note that before you execute any further commands, just make sure to switch to the user who has permissions to modify files if you’re not using shared hosting.

Backing up

Right now I’m primed so start executing my commands. The first thing I want to show you though is how to backup your database. It’s a super simple command, and you do this by typing:

After a few moments, you’ll see a message to confirm the backup was completed successfully.

List all modules

Now I can move onto my module actions. The following command allows me to see a list of currently enabled and disabled modules. Not only is it useful to see the status but it helps find the exact name we need to refer to when running the enabled and disable commands.

To run that command, type:

Disabling modules

Sticking with the Signifyd module, I’m going to need to take a note of its name for the next command. Scrolling through the list, I can see that its name is ‘Magento_Signifyd’. Now I can add it to the end of my disable command. I do this by typing:

A few moments after I hit enter, I’m prompted by a success message.

As I mentioned earlier, you can run this command in bulk. This is done simply by adding names to the end of the command. So, if I want to disable both of the WeltPixel modules I’d type:

Enabling modules

Enabling a module is very similar but with one extra step. First to enable the module I’ll just carry out the same command from before but substitute the word ‘disable’ for ‘enable’:

Once I see my success message, I need to run the upgrade command to finish the setup. This is done by typing:

And it’s as simple as that… If you have any follow up questions, be sure to drop them in the comments section or via the new forum. A link to the forum can be found in the video description below.

If you find yourself intrigued by the Command Line Interface and would like to learn more, then subscribe now and watch out for an upcoming mini-series that will talk you through step-by-step how to become more confident with it.

Craig

Craig

I've spent a chunk of my career working in eCommerce for a FTSE 100 company where I've worked in Web Development/Design, SEO and assisted in running an eCommerce business. If I can help anyone out, then I'll try my best.
Craig
Share on Pinterest

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.