How to update Magento 2 version using composer?

Before you update please take backup of files and database. Also go through the prerequisites like update and upgrade checklist, check PHP and environment settings & enable maintenance mode if needed. Let’s start!

STEP 1 – GoTo to root directory of your Magento 2 installation. Define your Magento version in the below command.

composer require magento/product-community-edition=2.3.4 --no-update

STEP 2 – Run the composer update command.

composer update

STEP 3 – At last run the following commands.

rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex

Thanks! Happy Coding Cheers.

Leave a Reply

Your email address will not be published.