Magento 2 has been constantly growing in number of files, tables and modules.  Benefits of removing some of the modules include:

  • Less code means less complexity and security risks
  • Less files - inodes hosting problems fixed - backups and restores are faster and smaller
  • Magento becomes faster  

To check your installed modules in the Admin part of Magento 2, visit:

System ->Web Setup Wizard -> Module Manager

To do the same using command line:

php bin/magento module:status

1. Disable and remove modules using command line.

./bin/magento module:disable -c module_name

Available options:

// -c clear static content, -r remove data

A detailed testing is recommended after disabling a module to make sure everything is working.  The same module is uninstalled using the following command:

./bin/magento module:uninstall -r -c module_name

To remove a module that has not been installed with composer  - just delete the files from app/code/ModuleName.  Then run the following command:

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy

Before deleting any modules we had to enable one:

./bin/magento module:enable Dotdigitalgroup_Email

//The following lines disable some of the modules in Magento 2.3

./bin/magento module:disable -c Vertex_Tax Vertex_AddressValidation Temando_ShippingRemover Magento_Usps Magento_SampleData Magento_BraintreeGraphQl Magento_Braintree
./bin/magento module:disable -c Dotdigitalgroup_Chat Dotdigitalgroup_Email
./bin/magento module:disable -c Amazon_Payment Amazon_Login Amazon_Core
./bin/magento module:disable -c Magento_Ups
./bin/magento module:disable -c Magento_Fedex
./bin/magento module:disable -c Klarna_Kp
./bin/magento module:disable -c Klarna_Ordermanagement
./bin/magento module:disable -c Klarna_Core

We disabled some Adobe modules as well

./bin/magento module:disable -c Magento_AdobeStockImage Magento_AdobeStockImageAdminUi Magento_AdobeStockImageApi
./bin/magento module:disable -c Magento_AdobeStockAsset Magento_AdobeStockAssetApi Magento_AdobeStockClient Magento_AdobeStockClientApi Magento_AdobeStockAdminUi

The next step is uninstall the already disabled modules

./bin/magento module:uninstall -r -c Dotdigitalgroup_Chat Dotdigitalgroup_Email
./bin/magento module:uninstall -r -c Amazon_Payment Amazon_Login Amazon_Core
./bin/magento module:uninstall -r -c Magento_Ups Magento_Fedex
./bin/magento module:uninstall -r -c Klarna_Kp Klarna_Ordermanagement Klarna_Core
./bin/magento module:uninstall -r -c Vertex_Tax Vertex_AddressValidation 
./bin/magento module:uninstall -r -c Temando_ShippingRemover Magento_Usps Magento_SampleData Magento_BraintreeGraphQl Magento_Braintree

Adobe modules uninstall

./bin/magento module:uninstall -r -c Magento_AdobeStockImage Magento_AdobeStockImageAdminUi Magento_AdobeStockImageApi
./bin/magento module:uninstall -r -c Magento_AdobeStockAsset Magento_AdobeStockAssetApi Magento_AdobeStockClient Magento_AdobeStockClientApi Magento_AdobeStockAdminUi

 2. Remove modules by using composer

composer remove temando/module-shipping-m2

To Upgrade a module

composer update mageplaza/module-core
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento info:dependencies:show-modules-circular

3.  Yet another way to remove modules in composer by replacing them by nothing

{
"name": "jvm/magento2-replace-modules",
"description": "Remove unused packages from Magento",
"require": {
"magento/product-community-edition": ">=2.3.0 <2.3.7"
},
"replace": {
"amzn/amazon-pay-and-login-magento-2-module": "*",
"amzn/amazon-pay-and-login-with-amazon-core-module": "*",
"amzn/amazon-pay-module": "*",
"amzn/amazon-pay-sdk-php": "*",
"amzn/login-with-amazon-module": "*",
"braintree/braintree": "*",
"braintree/braintree_php": "*",
"dotmailer/dotmailer-magento2-extension": "*",
"dotmailer/dotmailer-magento2-extension-chat": "*",
"dotmailer/dotmailer-magento2-extension-enterprise": "*",
"dotmailer/dotmailer-magento2-extension-package": "*",
"klarna/m2-payments": "*",
"klarna/module-core": "*",
"klarna/module-kp": "*",
"klarna/module-kp-graph-ql": "*",
"klarna/module-ordermanagement": "*",
"klarna/module-onsitemessaging": "*",
"magento/adobe-stock-integration": "*",
"magento/google-shopping-ads": "*",
"magento/module-adobe-ims": "*",
"magento/module-adobe-ims-api": "*",
"magento/module-adobe-stock-admin-ui": "*",
"magento/module-adobe-stock-asset": "*",
"magento/module-adobe-stock-asset-api": "*",
"magento/module-adobe-stock-client": "*",
"magento/module-adobe-stock-client-api": "*",
"magento/module-adobe-stock-image": "*",
"magento/module-adobe-stock-image-admin-ui": "*",
"magento/module-adobe-stock-image-api": "*",
"magento/module-amqp": "*",
"magento/module-amqp-store": "*",
"magento/module-authorizenet": "*",
"magento/module-authorizenet-acceptjs": "*",
"magento/module-authorizenet-cardinal": "*",
"magento/module-authorizenet-graph-ql": "*",
"magento/module-braintree": "*",
"magento/module-braintree-graph-ql": "*",
"magento/module-layered-navigation-staging": "*",
"magento/module-marketplace": "*",
"magento/module-msrp-staging": "*",
"magento/module-multishipping": "*",
"magento/module-new-relic-reporting": "*",
"magento/module-payment-staging": "*",
"magento/module-paypal-graph-ql": "*",
"magento/module-product-video-staging": "*",
"magento/module-quote-analytics": "*",
"magento/module-quote-graph-ql": "*",
"magento/module-related-product-graph-ql": "*",
"magento/module-review-analytics": "*",
"magento/module-review-staging": "*",
"magento/module-reward-graph-ql": "*",
"magento/module-reward-staging": "*",
"magento/module-rma-graph-ql": "*",
"magento/module-rma-staging": "*",
"magento/module-sales-analytics": "*",
"magento/module-sales-graph-ql": "*",
"magento/module-sales-rule-staging": "*",
"magento/module-sample-data": "*",
"magento/module-search-staging": "*",
"magento/module-send-friend": "*",
"magento/module-send-friend-graph-ql": "*",
"magento/module-signifyd": "*",
"magento/module-staging": "*",
"magento/module-staging-page-builder": "*",
"magento/module-store-graph-ql": "*",
"magento/module-swagger": "*",
"magento/module-swagger-webapi": "*",
"magento/module-swagger-webapi-async": "*",
"magento/module-swatches-graph-ql": "*",
"magento/module-tax-graph-ql": "*",
"magento/module-tax-import-export": "*",
"magento/module-theme-graph-ql": "*",
"magento/module-ups": "*",
"magento/module-url-rewrite-graph-ql": "*",
"magento/module-usps": "*",
"magento/module-vault-graph-ql": "*",
"magento/module-version": "*",
"magento/module-weee-graph-ql": "*",
"magento/module-weee-staging": "*",
"magento/module-wishlist-analytics": "*",
"magento/module-wishlist-graph-ql": "*",
"magento/module-worldpay": "*",
"paypal/module-braintree-core": "*",
"paypal/module-braintree": "*",
"temando/module-shipping": "*",
"temando/module-shipping-m2": "*",
"temando/module-shipping-remover": "*",
"vertex/module-address-validation": "*",
"vertex/module-tax": "*",
"vertex/product-magento-module": "*",
"vertex/sdk": "*",
"yotpo/magento2-module-yotpo-reviews": "*",
"yotpo/magento2-module-yotpo-reviews-bundle": "*"
}
}

Please contact us if you need assistance or check our Magento Services page.

If you have troubles with Magento TwoFactorAuth, you can disable it:

bin/magento module:disable Magento_TwoFactorAuth

Check our Magento Cloud Hosting solution that provides you with latest Magento version on a fast machine ready to start selling in no time!