Get Super Fast Managed Magento Hosting with FREE $25 Credit. Use Promo Code: MGT25
AVAIL NOW

How to Enable or Disable Magento 2 Extensions

Magento 2 is one of the most well-recognized platforms in the ecommerce world due to its awesome features, support, security and many other features involved.  For making your store more efficient for your customers you need to give some more advanced options and for that extension is a solution. There are a large number of useful Magento 2 extensions which can be used to add more functionality and customization to your store. So, today in this guide, I will teach you how to enable or disable Magento 2 extensions.

Why Should You Disable Magento 2 Extensions?

At times, your Magento 2 powered store might be plagued with unnecessary extensions installed which are not in use and can affect its performance. To keep your store’s performance optimal, you need to delete them, but if you plan on using them again in the future, then disabling those Magento 2 extensions is a great option.

Now move to the execution, you can enable or disable extensions in Magento 2 by two different methods:

  • Method 1: Enable or Disable Magento 2 Module Via Command Line
  • Method 2: Enable or Disable Magento 2 Module Via config.php File

Let’s assume you have one extension installed in your Magento 2 store: Magenticians_Mymodule. I will tell you both enabling and disabling it.

Method 1: Enable or Disable Magento 2 Extensions Via Command Line

Launch SSH terminal to connect your Magento 2 store and go to the root directory of your Magento 2 store.

To disable Magento 2 extension via CLI, run the following command:

php bin/magento module:disable Magenticians_Mymodule

To enable Magento 2 extension via CLI, run the following command:

php bin/magento module:enable Magenticians_Mymodule

Then run some more commands. First, you need to upgrade the setup:

php bin/magento setup:upgrade

Then clean and flush the cache:

php bin/magento cache:clean

php bin/magento cache:flush

Method 2: Enable or Disable Magento 2 Extensions Via config.php File

Another method to disable and enable extensions in Magento 2 is via the config.php. To implement this method, connect your Magento 2 store with FileZilla and go to the root directory. Now open a config.php file from app/etc directory. Here you can see the list of extensions which are installed on your Magento 2 store:

In the above code, I have set the value of Magenticians_Mymodule to 0 which means the module is disabled, to enable it, change it to 1.

Lastly, you need to upgrade the setup by running this command in your Magento 2 store’s root directory:

php bin/magento setup:upgrade

Don’t forget to clear the cache by running this command:

php bin/magento cache:clean

php bin/magento cache:flush

Things to Remember While Enabling or Disabling Magento 2 Extensions

Some modules have dependencies on other modules due to which, modules can be disabled or enabled. Here are some examples of it:

  • If Module A depends on module B, then you have to disable Module A first because you cannot disable Module B directly.
  • If Module A depends on module B, then you have to enable Module B first because you cannot enable Module A directly.
  • If Module A conflicts with Module B then you cannot enable Module A and Module B at the same time. However, you can disable Module A and Module B, or you can disable either module.

Final Words

Enabling and disabling extensions can help make your Magento 2 store perform better and it can boost the sales. I believe you can now easily enable or disable Magento 2 extensions. If you still face issues or have any confusions related to this post then drop your comment below and I will get back to you.

 

About Author

Syed Muneeb Ul Hasan is an expert in PHP and Magento, he prefers to educate users in implementing and learning Magento. When not working, he loves to watch cricket.