Magento 2 has a several ways, how to disable extension, and they all have own pros and cons. In this article I would like to overview command line method. It completely makes an extension inactive. That means an extension will not effect any other extensions anymore and all extension’s functionality will be removed from store. It is a simple and effective way to disable extension temporary without deleting all extension files.
The following command will do the trick
bin/magento module:disable Vendor_ModuleName
The same easy is to bring it back with the following command:
bin/magento module:enable Vendor_ModuleName
Guide for beginners
The previous example is a simple ssh command which should be executed in your server side. To use this method you have to have an ssh access of the server. Unfortunately it is not working in hosting without ssh access.
Before begin I would like to highlight some details:
- The example was made on local server which is running on ubuntu 16.04
- My server user name: vagrant, host: 127.0.0.1, port: 22
- In this example I will use Magetrend_HelloWorld extension.
1. Connect to server via ssh
The first step is to connect to your server via ssh. It very depends on your operating system and what authorization methods are available in your server, but I hope it’s not the first time when you’re connecting it.
ssh username@server_ip -p port_number
2. Change directory to magento root
In the second step, we need to navigate to Magento directory. To complete this step successfully you need to know where is your Magento directory. In my case, the directory is /var/www so we need to run the following command
3. Run command
And now we can run that command which do the trick!
bin/magento module:disable Magetrend_HelloWorld
4. The following actions
As you can see in response from the server, additionally there is need to compile Magento files. You can compile the files with the following command.
And that’s the trick!
No modules were changed
You might get this response from the server. It means that the extension is already disabled.
Unknown module(s): ‘*’
This error message means that there is a mistake in extension name and Magento can not find it.
To get more details about this Magento 2 function you can check official Magento 2.3 documentation. We hope this article will be a great help for Magento beginners or for who are not very technical. Let me know in the comments bellow, if something is missing. I will be more than happy to append this post with your case.