Jon Dramond Jon Dramond
Reading Time: 1 minute

When you run a Magento 2 store, it is important that your site is impressive to your customers and that it functions properly. Customers respond well to stores that have added features and these are often added through Magento 2 extensions. In this guide, we are going to discuss how you can enable and disable Magento 2 extension. Make sure to keep reading to find out more.

Why Disable Extensions?

Extensions can be great, but often developers decide that they don’t want to use certain ones anymore. This then means that these extensions end up remaining in the store, disrupting the performance of the store. These extensions can be deleted but sometimes developers don’t quite want to get rid of them just yet. This is why you should think about disabling any extensions that you are not currently using in your Magento 2 store. When you disable them, you have the option to add them back to your store in the future.

Using Command Line When Enabling or Disabling Extensions

To go to the root directory of your store, you’ll need to launch the SSH terminal. If you want to disable an extension, then you should use the following CLi:

php bin/magento module:disable Yourstore_Mymodule

If you want to enable an extension, then you should try:

php bin/magento module:enable Yourstore_Mymodule

After this, you’ll need to upgrade the set up using the following code:

php bin/magento setup:upgrade

Then, clean and flush the cache using:

php bin/magento cache:clean

php bin/magento cache:flush

After this, you should have successfully enabled or disabled the extension that you wanted to.

Using config.php File When Enabling Or Disabling Extensions

There is, of course, another method to enable and disable to the Magento 2 extensions. You’ll need to first access your store using FileZilla and then locate the root directory. After this, you should open a config.php file that you’ll find in the app/etc directory.

Here, a list of the extensions on your site should appear with values beside them – either 1 or 0. To enable the extension, you should change the value to 1 and to disable it, change it to 0.

After this, you’ll need to upgrade the set up using the following code in the root directory:

php bin/magento setup:upgrade

You’ll then need to clear the cache just like in the other method:

php bin/magento cache:clean

php bin/magento cache:flush

Important Tips When Enabling or Disabling Extensions

When you are disabling or enabling extensions, you will need to check if there are any other modules which have dependencies on this module. You might find that one module depends on another and so you will have to disable the first module first since you cannot disable the one that it depends on directly. Any sort of conflicts will also need to be figured out as you cannot always disable a module if it has something depending on it. Make sure to follow our code carefully and soon you will be able to disable or enable an extension in your Magento 2 store.