When Magento announced the launch of Magento 2.3.0, even our team of certified, experienced Magento developers were worried the world as we know it would end (slightly overdramatic, we know…).

Magento needs to be upgraded, it’s a fact of life we’ve come to accept. As an Official Magento Solutions Partner, we’re familiar with all Magento 2 versions, we know how to carry out migrations from other platforms and we’re used to dealing with upgrades. Normally upgrades are a relatively pain-free experience, other times you need to update to a major release – this was one of those times.

Turns out, that for all our complaining, it was moderately straight forward. What previously took us half a day to do, is a much quicker process now that we understand how to correctly prepare Magento for the upgrade. So much so that we thought we’d shared the benefit of our experience with fellow Magento developers. Here it goes…

Before you start

If you’re upgrading a store with third-party modules, make sure that they are up to date otherwise you will get errors when you try to load the frontend of the site, and ensure you have the latest PHP version. Magento 2.3 requires at least PHP 7.1.3 to be installed and used on the server.

Prep the Patient

*Create your own branch and backup the database.*

Something we ran into that is also worth noting; the upgrade didn’t like table prefixes. For some reason we couldn’t complete the upgrade because the current instance used table prefixes on the database tables. The only way around this was to remove them.

Thanks to the introduction of Magento using Composer, there are just a few essential steps that need completing to get the upgrade ready, these are:

  1. Update the version of Magento. Run this command to get the version number to 2.3:

composer require magento/product-community-edition=2.3.0 –no-update

  • Run this command to add additional packages to composer.json:

composer require –dev phpunit/phpunit:~6.2.0 friendsofphp/php-cs-fixer:~2.10.1 lusitanian/oauth:~0.8.10 pdepend/pdepend:2.5.2 sebastian/phpcpd:~3.0.0 squizlabs/php_codesniffer:3.2.2 –no-update

  • This command will remove some unused packages from composer.json:

composer remove –dev sjparkinson/static-review fabpot/php-cs-fixer –no-update

  • You will now need to update composer.json manually to add something to the autoload section, under psr-4:

“Zend\\Mvc\\Controller\\”: “setup/src/Zend/Mvc/Controller/”

The section should now look like this:

“autoload”: {

    “psr-4”: {

        “Magento\\Framework\\”: “lib/internal/Magento/Framework/”,

        “Magento\\Setup\\”: “setup/src/Magento/Setup/”,

        “Magento\\”: “app/code/Magento/”,

        “Zend\\Mvc\\Controller\\”: “setup/src/Zend/Mvc/Controller/”

    },

    …

}

You’ll notice that we included –no-update in each section. It’s quicker and easier to do this all at once rather than going back through the code after the update.

Running the Update

You should now be ready to perform the actual Magento 2.3 update. Now that you’ve prepped the instance, you can run this command:

[Composer Update] – This will take a while, so you probably have time to go make yourself a cup of tea!

Once the update is complete, you’ll need to clear the caches and regenerate the code. Thankfully these can be done with three simple commands:

php bin/magento setup:upgrade

php bin/magento setup:di:compile

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

You should have a fully working version of Magento 2.3 installed!

Contact Team Pinpoint for more information about Magento upgrades or how to migrate to Magento 2.