Is it possible to disable or remove a module functionality from Magento2 ? Yes, its possible! This can be done easily from admin side of your store or from commandline.

I) Enable/Disable module from store admin side:
You can enable/disable module from below location:
admin-> Stores-> Configurations-> Advanced-> Advanced-> Disable Modules output
then enable/disable required module and click on ‘Save Config’ button. You need to clear corresponding cache to reflect the changes in website.

II) Enable/Disable module from commandline:
Magento provide command line utility for enable/disable module. Login to terminal and then go to your project root using below commands (assume your project name is ‘magento213’):
Xampp : cd /opt/lampp/htdocs/magento213
Ubuntu : cd /var/www/magento213
CentOS : cd /var/www/html/magento213
Windows : cd /d/xampp/htdocs/magento213

Magento allow you to enable or disable any of its module (any Magento-default module or any third-party module) that is currently available. Certain modules have dependencies on other modules, in such case Magento might not allow to enable/disable a module because it has dependencies on other modules.

Sometimes there might be conflicting so you cannot enabled both module at the same time.
You can find ‘dependencies’ declared in the ‘require’ field in modules ‘composer.json’ file.
You can find ‘conflicts’ declared in the ‘conflict’ field in modules ‘composer.json’ file.

Magento use that information to build a dependency graph. If you attempt to enable/disable a module that depends on other modules, the dependency graph displays in the error message.

Disable a module:
If you want to disable a module for example ‘Magento_AdminNotification‘ then run below command in commandline. Similarly you can disable any module by specifying its name.


Note: Using –force can disable your Magento store and cause problems accessing the Magento Admin. So please use carefully.

 

Enable a module:
Suppose you want to enable a module for example ‘Magento_AdminNotification‘ then run below command in commandline.

Note: Before enable/disable a module through commandline, you need to give full permission to ‘var/’ folder.

 

Additional information:
Magento2 provides a command php bin/magento to show all command line guide. The result will be like this:

 

Errors and solution
Errors 1
[Magento\Framework\Exception\FileSystemException]
Deployment config file config.php is not writable.

Solution: Give full permission to file “app/etc/config.php”

Errors 2
Command line user does not have read and write permissions on var/generation directory.
Please address this issue before using Magento command line.

Solution: Give full permission to folder “var/generation”. If not worked then give full permission to entire “var/” folder.

Errors 3
No modules were changed.
Solution: This message shows in command line when you are trying to enable/disable a module that already in same status.

 

Conclusion:
It comes to the end of tutorial. Now you are ready to enable or disable a module in Magento2 !

You can find Magento 2 pre-launch check list here

Thank you for reading this post!!!