How to uninstall an extension?

How to uninstall an extension?

Preparation

  1. Before making any changes to your Magento instance, either live or a dev site, make sure to create backups. This way you can secure the changes in case something goes wrong in the process.
  1. So that the uninstall goes smoothly, it's recommended to disable the modules beforehand.
  1. For the uninstallation, one of the first steps to undertake is to define the installation method. Based on this, different actions are required. To find out how the module was installed, check where the module files are located. Modules installed via direct file upload have their files in Magento_root_directory/app/code/amasty . The modules installed via composer locate their files in Magento_root_directory/vendor/amasty . 

Uninstall process

Direct file upload

If the module was installed via direct file upload, please remove the module folder from Magento_root_directory/app/code/amasty .

It's important to be aware that uninstalling the extension files will not affect any database changes. For a complete removal of the extension data, you must manually clear the associated database tables.

Composer

For composer-installed modules, the uninstallation should also be done with the use of composer.

Step 1. Log in to your server via CLI and navigate to the Magento root directory.

Step 2. Run the command to remove the files:

composer remove amasty/module-name

If you'd like to uninstall the extension with DB data, use this command instead: 

bin/magento module:uninstall [Module_Name]

Step 3. With the help of the command above, the module files will be deleted from the server. But before the composer.lock file is updated, the module still has dependencies created in your instance. Before these are deleted, the composer won't let you perform the setup scripts to restart the instance. To remove the dependencies, run:

composer dump-autoload

Final steps

On this stage, you need to run the setup scripts. The basic recommendation is to redeploy the static content, though depending on the instance peculiarities, other actions might need to be performed (like cache flush and etc).