When you start using Magento, you may install various Magento 2 extensions. Out of curiosity, learning, checking, and just testing.
The store will grow with time and due to all the marketing efforts. You will realize that you do not need all those extensions. You have found the better alternative that fits your store better. Some extensions stop getting updates and become a security issue.
In that case, you should know how to uninstall a Magento 2 extension from the store.
Uninstalling a Magento extension is not enough. They leave residue behind, and that affects the store’s performance. At the least, they take up space on the server.
Disabling vs. Removing a Magento 2 Extension
The difference between disabling and removing a Magento 2 extension is that when you disable the extension, the data remains intact in the Magento database, silently, and ready to be re-used with all the settings, configurations, and customization you made. However, when you remove/delete a Magento extension, its content, data, and settings are deleted from the Magento store completely.
Unlike Magento themes, you can keep more than one extension enabled at any moment. That’s why users typically disable an extension and leave it as it is without deleting the data.
A disabled but not deleted Magento extension still have access to your site, and enough to make it vulnerable. Hackers can use it to run malicious scripts and scrape your data, including username passwords.
How to Uninstall a Magento 2 Extension?
Uninstalling an extension is not a straight task. The extensions leave the data in unexpected files and folders in the Magento Database.
In this quick tutorial, I am sharing two methods to uninstall and remove a Magento 2 extension:
The extension uninstallation method depends on its installation process.
#1 Uninstall a Magento 2 Extension Manually
Connect via SSH to the root of your Magento installation (the folder that contains the app folder). Check the list of all extensions, including their enable/disable status.
php bin/magento module:status
Use the following commands to disable the extension.
php bin/magento
module:disable <ExtensionProvider_ExtensionName> --clear-static-content
php bin/magento setup:upgrade
Delete/Remove the extension files that were left behind.
cd app/code/<ExtensionProvider>/
rm -rf <ExtensionName>
Note: Do not remove the shared extension if you have multiple extensions from one vendor. It will delete the dependency pack, which works as a base for all of their extensions.
#2 Composer Uninstallation Method
Connect via SSH to the root of your Magento installation (the folder that contains the app folder). Check the list of all extensions, including their enable/disable status.
php bin/magento module:status
Use the following commands to Disable the Magento 2 extension.
php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
php bin/magento setup:upgrade
composer remove VendorName/VendorExtensionRepository
After removing the extension, you should also remove the extension attribute and the product attribute the extension might have created. You have to remove the extension attribute from the database table.
- Login to phpMyAdmin
- Search table >> ‘eac_attribute’
- Delete the extension attribute
Wrap Up
This quick tutorial taught us how to uninstall and remove a Magento extension.
You can keep lots of extensions on the Magento store. It is not the number but the extensions’ quality that impacts the Magento performance.
However, quality extensions are only available for popular objectives despite thousands of Magento extensions. Specific Magento functions are performed by mediocre coded modules and extensions, so you should deal with them carefully.
If you have any questions or doubts, please leave them in the comment box below.