How to Uninstall and Remove a Magento 2 Extension

Once you install Magento 2, usually you require to install Magento 2 extensions to build a fully functional store. As the time and website grow, you realize that some of the extensions are not best-fit or some forfeit their usefulness or their functionality is no longer required or you require reinstallation, it’s time when you want to uninstall and remove a Magento 2 extension.

Moreover, when there are a large number of extensions in Magento 2 store, it affects various factors adversely, although offering its functionality. Such factors are the increase in loading time, conflictions occurring between two extensions, SQL errors due to third-party extensions. Due to these reasons, you may require to uninstall a Magento 2 extension.

Also, you may want to remove a module that offers the same functionality as an already installed extension.

A large number of extensions also results in the complexity of store structure. Isn’t this enough reason to remove the unwanted extensions? Let’s see how the process can be done.

Uninstalling an extension should be a simple task but not always. They leave behind data in a number of places in the database which occupy unnecessary space and affects the store’s performance. Today, I have come up with 2 methods to uninstall and remove a Magento 2 extension.

  1. Manual Uninstallation
  2. Via Composer

The extension uninstallation method depends on its installation process.

Step 1: Connect via SSH to the root of your Magento installation (the folder that has the app folder in it) and go through the list of all extensions including their enable/disable status

Step 2:  Disable the extension by executing the given commands:

Step 3: Remove the extension files

Note: Don’t make the mistake to remove the shared extension from a common vendor. You may end up deleting the dependency pack that serves as a base for all their extensions.

Example: Suppose you are using Magento 2 Flat Rate Shipping Extension by Meetanshi and you want to uninstall it and remove all associated files:

Step 1: Connect via SSH to the root of your Magento installation (the folder that has the app folder in it) and check the list of all modules including their enable/disable status

Step 2: Disable the module by executing the given commands:

  • You can find the exact match for ExtensionProvider and ExtensionName in composer.json file associated with the module.
  • Also, you can get VendorName and VendorExtension in composer.json file associated with the extension.or under yourmagentoinstallation/com/vendor/<VendorName>/<VendorExtension>
  • If you are asked for composer username and password while the uninstallation process, navigate to var/composer_home/auth.json.

Example: Let’s take the example of the same extension for this method as well. First of all, disable the extension, run the setup upgrade and finally remove the files via composer:

Note: Along with removing the extension, you would want to remove the extension attribute or product attribute that might be created. If so, remove the extension attribute from the table with this method:

go to phpmyadmin -> search table “eav_attribute”
and remove that extension attribute from the table

I have tried to present the easy ways to uninstall a Magento 2 module. Still, if you face any difficulty in the process, please mention the doubts in the comments section below. I’d be happy to help.

Also, you can always follow the Magento DevDoc to uninstall modules.

Rate the blog with 5 stars to appreciate the work 🙂

CTA_contact

4.9
(based on 23 Reviews)
How to Uninstall and Remove a Magento 2 ExtensionAuthor Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

5 Comments

  • Ammer Naber

    I can sucessfully disable the module but I can not remove it.
    The files are still in vendor/

    Disable Module Successful:
    bin/magento module:disable Mageplaza_Webhook
    The following modules have been disabled:
    – Mageplaza_Webhook

    Remove Not Succesfull:
    composer remove Mageplaza_Webhook
    mageplaza_webhook is not required in your composer.json and has not been removed
    Package “mageplaza_webhook” listed for update is not installed. Ignoring.
    Nothing to install or update

    Please advise. Thanks!

    • Sanjay Jethva

      Hello,

      There is a mistake in the command that you have run.
      What you have to do is instead of composer command to install the extension, you have to replace composer require with composer remove.

      Still, if you find an issue, follow the below steps:

      1. Open the composer file of the installed extension vendor.
      2. Copy the name defined in the composer file
      3. Run composer remove

      That’s it.

  • Juanita Bacon

    i did not enable this so i need more info as to how to disable it.

  • Syed Muneeb Ul Hasan

    Thanks for sharing this post. Keep up the good work!

    You can also disable/enable Magneto 2 extensions by changing the value of module from 1 to 0 in app/etc/config.php.

Leave a Reply

Your email address will not be published.