Having your online store secure and with fewer bugs is one of the top priorities of each merchant. You can achieve it by updating Magento and Magento 2 extensions.

It's a relatively easy task for the experienced developer. But updating an extension in Magento can be challenging if you perform it for the first time. So it's important to know the precise steps you have to take.

Note: the update instructions usually depend on the method the Magento 2 extension was installed with.

Update Magento 2 Extension via Composer

If the extension files are located in the folder vendor/company/module-name, then the extension was installed using the composer. So you need to use the following steps:

1. Open CLI (Command Line Interface).

2. Navigate to Magento 2 root folder.

3. Run the following commands:

composer remove company/module-name
composer require company/module-name ^x.x.x
# replace x.x.x with the version you want to use
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

Note: if you don't want your website to be down during deployment, try these zero downtime deployment commands for Magento 2.

Update Magento 2 Extension via FTP/SFTP

In case you see the extension files in the app/code/Company/ModuleName folder, it was installed manually using FTP/SFTP. And the update steps will be the following:

1. Download the latest extension archive.

2. Extract the files.

3. Using FTP/SFTP upload new files to your server (replace all existing files if needed).

Note: if you can see "app" folder in the archive, then it should be uploaded to the root folder of your Magento. If there are some other folders and files like "registration.php", "etc", "Model", "Plugin", "Block", then upload all of them to app/code/Company/ModuleName.

Update Magento 2 extension via FTP

4. Open CLI (Command Line Interface).

5. Navigate to Magento 2 root folder.

6. Run the following commands:

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

As we've mentioned above, updating the Magento 2 extension is not an overly complicated task. Yet, we recommend creating a backup of your Magento 2 files and database just in case.

  • Do we provide both installation methods for our extensions?

    Yes, all Magefan extensions can be installed via composer and FTP. We provide installation guides in every extension user guide.

  • What is PHP Composer?

    It's the package manager for PHP, it allows you to manage dependencies of Magento 2 extensions and PHP libraries. It also facilitates the upgrade process.

  • Are there composer packages for Magento 2 extensions.

    If you use the Magefan extension, then the answer is YES. You can install and update any Magefan extension via composer. Please contact the extension vendor to find out if their extension can be installed/updated via composer.

  • What to do if I get error "Module 'Company_Module' from 'app/code/Company/Module' has been already defined in 'vendor/company/module'."?

    Please check how to fix this issue.