Keeping your online store secure and with fewer bugs is one of the top priorities of each merchant. That's why you want to keep Magento and Magento 2 Extensions up-to-date.

Updating the extension is not a hard task but it can be challenging if you perform it for the first time. If you are not a technical person, we always recommend using a professional upgrading service.

If you wish to update Magento 2 extension by yourself please follow the steps below:

(In the guide, we update module Company_ModuleName).

1. Create a backup of your Magento 2 files and database.

2. Define using which method the extension has been originally installed with to define the file structure of the module.

If the extension files are located in the folder vendor/company/module-name, then the extension was installed using the Composer and you need to use the Composer for the upgrade.

If you can find extension files in the folder app/code/Company/ModuleName, then the extension was installed manually using e.g. FTP/SFTP and you need to use FTP/SFTP to upgrade it.

Update Magento 2 Extension via Composer

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

1. Download the latest extension archive.

2. Extract the files on your computer.

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

Note: if in an archive you can see "app" folder, then "app" folder should be uploaded to the root folder of your Magento. If there is some other folders and files e.g: "registration.php", "etc", "Model", "Plugin", "Block", then upload all these files and folders 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

FAQ:

1. 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.

2. What is PHP Composer?

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

3. Does the Composer package exist for the extension?

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

 4. 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.

Do you have more questions? Please let us know in the comments below.