Categories: Magento 2 Tutorials

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:
<?php
return array (
'modules' =>
array (
'Magento_Store' => 1,
'Magenticians_Mymodule' => 0,
'Magento_Directory' => 1,
'Magento_AdvancedPricingImportExport' => 1,
'Magento_Config' => 1,
'Magento_Backend' => 1,
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.  
Syed Muneeb Ul Hasan

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.

Share
Published by
Syed Muneeb Ul Hasan

Recent Posts

Building Employee Trust and Dedication – A Complete Guide

In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More

3 months ago

12 Winning Strategies for Small Businesses Marketing

In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More

3 months ago

Top 10 App Development Companies in Dubai 2024

With one of the highest internet penetration rates, the UAE has set out to revolutionize… Read More

3 months ago

Transforming Industries: How Amazons GPT44X is Revolutionizing AI Technology

Artificial Intelligence (AI) has been continually evolving, leading to remarkable advancements in various industries. Among… Read More

8 months ago

Top Magento 2 Extensions for 2023

Extensions, extensions and lots of extensions. We all love extensions, don’t we? After all, extensions… Read More

11 months ago

Unleashing the Power of Software Testing: Cooperating with a Testing Firm

Software quality is crucial to a firm's success across industries in the quickly changing digital… Read More

12 months ago