logo company

Contact us:
+(48) 572 970 235 or Book a call
Guides Magento Optimization Custom website development Security

How to Upgrade Magento 2 to the Latest Version?

0%
How to Upgrade Magento 2 to the Latest Version?

Businesses involved with e-commerce sales rely on Magento 2 to provide an interactive shopping experience for their customers. Online merchants gain full control and improve performance over the functionality of their stores by accessing flexible tools through this open-source platform solution. 

To maintain a high level of performance, regular upgrades should be performed. Below, we offer a step-by-step guide for upgrading to the latest version of Magento 2.

 

Benefits of a Magento 2 Upgrade

Similar to any software that you have on your computer, laptop, or phone, new versions of the Magento platform provide revamped, improved performance. Fresh releases offer a range of security and compatibility upgrades, address functionality bugs, and offer new features. Regularly performing a Magento 2 upgrade ensures that your website runs smoothly and is fully compatible with other software systems you use.

 

Before Starting a Magento 2 Upgrade

 

Select a Magento Product for the Upgrade

There are several steps to take before getting to the actual upgrade process. If you don’t already have the version in mind, start with deciding which version of Magento 2 is the best fit for your online store. As of 2024, the latest Magento version is 2.4.7. 

 

Check Compatibility

Next, evaluate your existing online store setup to ensure compatibility with the Magento 2 version you’ve chosen. You should check both your PHP and your MySQL/MariaDB versions for compatibility to avoid any future installation issues.  

 

Pick a Magento 2 Upgrade Service

You have multiple choices for a Magento 2.0 upgrade. When choosing an option, base your decision on the knowledge of and skills in Magento or the level of Magento experience in your IT team. Here are some of the options you can choose from:

  • Manual Magento Upgrade
  • Upgrade Magento 2 with Composer

You can also hire a company to provide Magento 2 upgrade services. This is the safest and most effective option, especially if you don’t have dedicated IT experts in-house.

 

Creating a Backup of All Data

It is extremely important to back up all your online store's data before performing any type of Magento upgrade. A backup ensures that your site data won’t get lost even if a serious issue arises during the upgrade. You can also roll back to the previous version if something goes wrong.  

 

Option 1 – Manually Upgrade Magento 2

 

Step 1: Download the Latest Version of Magento 2

First, you need to download the .zip file of Magento 2 to your root directory. Head to the official Magento website and select the needed version. Next, place the downloaded files into the Magento root directory and unzip the downloaded package to access the latest version.

 

Step 2: Extract the Package and Run SSH Commands

Running SSH console commands allows you to clear cache, refresh the database schema, and perform other functions for better performance. After the extraction process, run each of the following commands one by one:

  • php bin/magento setup:upgrade
  • php bin/magento setup:static-content:deploy
  • php bin/magento cache:clean
  • php bin/magento indexer:reindex

The bin magento setup static content, php bin magento setup, and reindex commands are all essential for the completion of the upgrade. After completing them, look at the admin panel as well as the front end to ensure the upgrade worked as expected.

Option 2 – Upgrade Magento 2 with Composer

 

Step 1: Enable Maintenance Mode

You may have customers using your online store exactly when you want to perform the upgrade. Entering the maintenance mode can prevent disruptions while the new Magento 2 version is being installed. Simply turn on the php bin Magento maintenance using this code line:

-- php bin/magento maintenance:enable --  

 

Step 2: Upgrade to Latest Magento Product

When completing the next step, you need to know the full name of the specific Magento 2 release that you’re installing. You’ll be asked to input this product version number into the Magento product command in place of the “x”. For example, if you are upgrading from Magento 2.4.1 to Magento 2.4.6, you need to input the full product version:

  • composer require magento/product-community-edition 2.4.6 --no-update composer update

During this process, you may be prompted to include a username and password. These are access keys, where the username is the public key and the password is the private key. You can get the keys by following this link. Once you enter the keys, the installation will start.

 

Step 3: Flushing the Cache and Running an Upgrade Module

After performing the upgrade, you want to flush the cache and run the upgrade module. This is a straightforward process as you need to place the following command lines into the root folder: 

  • rm -rf var/cache/*
  • rm -rf var/page_cache/*
  • rm -rf var/generation/*

Next, perform the following commands:

  • php bin/magento setup:upgrade
  • php bin/magento setup:di:compile
  • php bin/magento indexer:reindex

The bin commands help you run the upgrade module for the database schema as well as compile and reindex.

 

Step 4: Check the Product Version and Turn Off the Maintenance Mode

You should first check if you have the right product version enabled on your e-commerce website. Run this command: php bin/magento --version, and look at the product version number displayed.

Once you’ve verified that you have upgraded Magento 2, turn the maintenance mode off. The command to turn off maintenance mode is: 

php bin/magento maintenance:disable. 

 

Other Magento Upgrade Options

Alternatively, you can use methods such as Web Setup Wizard. All you need to do is follow the instructions presented on the screen – and you’ll have your Magento updated. However, the Wizard is only suitable for e-commerce websites using Magento under 2.4.x versions. 

Another way is to rely on a company that offers a Magento upgrade service. The cost to upgrade to Magento 2 will depend on the company as some charge by the hours while others give a flat rate for the service.

sergey-g

Written with the assistance of Sergey G.

Adobe Commerce Business Practitioner | Certified PSM & PSPO at TA

Sergey ensures project success by validating business cases, defining success metrics, and identifying sustainable benefits. His proactive approach leverages existing systems, processes, and data to deliver additional value. Serge excels in planning, executing, monitoring, and controlling all aspects of the project lifecycle, ensuring meticulous attention to detail and strategic oversight.

sergey-g

Written by Sergey G.

Adobe Commerce Business Practitioner | Certified PSM & PSPO at TA

Sergey ensures project success by validating business cases, defining success metrics, and identifying sustainable benefits. His proactive approach leverages existing systems, processes, and data to deliver additional value. Serge excels in planning, executing, monitoring, and controlling all aspects of the project lifecycle, ensuring meticulous attention to detail and strategic oversight.

Previous How to Remove Powered by Shopify? With Examples Next Build a Better E-commerce Website: Avoid Common Pitfalls
0 Comment(s)
To Top