Wednesday, March 4, 2020

How to uninstall and remove a Magento 2 extension ( manual vs composer )

Hello 
Here I saw you how to remove the extension by manually or composer.

A. Manual Uninstall
Step 1: Connect via SSH to the root of your magento installation (this is the folder that has the app folder in it) and check the list of all modules including their enable/disable status
·         php bin/magento module:status

Step 2:  Disable the module by executing below commands:
·         php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
·         php bin/magento setup:upgrade

Step 3: Remove extension files
·         cd app/code/<ExtensionProvider>/
·         rm -rf <ExtensionName>
!Note: If you are using more extensions from the same provider make sure not to remove the shared extension, most providers use a shared extension or dependency pack as a base for all their extensions.
  
Example: Let assume you are using Chirag Outofstock Extension and you want to uninstall it and remove all associated files:
·         php bin/magento module:disable Chirag_Outofstock --clear-static-content
·         php bin/magento setup:upgrade
·         cd app/code/Chirag/
·         rm -rf Outofstock

Important: If you are using other Outofstock extensions make sure not to remove the 'Backend' shared extension as it is used by the rest of Outofstock installed extensions. If you do not have any other Outofstock extensions it is safe to uninstall and remove also the 'Backend' extension.
  

B. Composer Uninstall
Step 1: Connect via SSH to the root of your magento installation (this is the folder that has the app folder in it) and check the list of all modules including their enable/disable status
·         php bin/magento module:status

 Step 2: Disable the module by executing below commands::
·         php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
·         php bin/magento setup:upgrade
·         composer remove VendorName/VendorExtensionRepository

Note: you can find the exact match for ExtensionProvider and ExtensionName in composer.json file associated with the extension.
Note2: you can find the exact match for VendorName and VendorExtension in composer.json file associated with the extension.or under yourmagentoinstallation/com/vendor/<VendorName>/<VendorExtension>
Note3: You may be asked for composer username and password when uninstalling, you will be able to find them under var/composer_home/auth.json

Example: Let assume you are using Chirag Outofstock Extension and you want to uninstall it and remove all associated files. First thing you should disable this extension, run the setup upgrade and finally remove the files via composer:
·         php bin/magento module:disable Chirag_Outofstock  --clear-static-content
·         composer remove chirag/m2-chirag_outofstock
·         php bin/magento setup:upgrade

Important: If you are using other Outofstock extensions make sure not to remove the 'Backend' shared extension as it is used by the rest of Outofstock installed extensions. If you do not have any other Outofstock extensions it is safe to uninstall and remove also the 'Backend' extension.

No comments:

Post a Comment