In this article, you will learn how to upgrade the Magento 2 AMP extension from v2.x to v3.x using two methods – via FTP or Composer.
Important Information:
We strongly recommend upgrading and testing the AMP extension in a development environment before deploying it on the production shop.
Step 1. Back Up the Customizations
Back up the app/design/frontend/[vendor]/[theme_name]/Plumrocket_Amp
file and remove it from the [theme_name]
folder.
Step 2. Update the Extension
You can choose one of the two following methods to update the extension on your Magento 2 store:
Updating Extension via Composer
First, remove the following folders if they exist:
app/code/Plumrocket/Amp
app/code/Plumrocket/Base
app/code/Plumrocket/ExtendedAdminUi
Then, update the extension files by running the following command from the Magento root directory:
- Use this command if the AMP v2 Extension was installed in the
vendor/plumrocket/module-pramp
folder.
composer update plumrocket/amp-theme-one plumrocket/module-pramp --with-dependencies
- Use this command if the AMP v2 Extension was installed in the
app/code/Plumrocket/Amp
folder.
composer require plumrocket/amp-theme-one plumrocket/module-pramp
After running the command, you may be prompted to enter the username and password. In order to find your personal Username and Password to update the extension via the Composer, go to your Plumrocket account > My Downloads, find the required Plumrocket extension in the list, and click the Install via Composer link.
Run the next four Magento 2 commands to complete the updating process:
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Updating Extension via FTP
In order to update the extension files via FTP, remove the app/code/Plumrocket/Amp
folder and perform the Installation via FTP steps.
Step 3. Validate AMP Pages
At first, we recommend checking the var/log/exception.log
exception log for AMP-related exceptions errors. After that, you can start validating AMP pages using our guide on how to validate AMP pages.
Step 4. Integrate Your Third-Party Modules With the AMP Extension
In your third-party modules, disable functionality that you do not need for the AMP store version. In order to disable this functionality for the AMP version only, you can use the \Plumrocket\AmpApi\Api\IsAmpModeInterface::execute
method.
Next, you need to add the functionality you want to reproduce on AMP pages. To do this, create a custom AMP theme along with custom AMP templates, layouts, CSS, etc.
Step 5. Add the Customizations You Had Before
If you used a custom AMP design, you have to customize the AMP Theme One using the custom AMP theme created in the previous step.
Step 6. Validate AMP Pages
After you have added all customizations, you should validate your AMP pages again. In the future, keep Magento AMP Pages Valid With Google Search Console.