How to apply a custom patch on Magento Cloud?

How to apply a custom patch on Magento Cloud?

Please make sure to test all patches in a pre-production environment. For Adobe Commerce on cloud infrastructure, you can create new branches with the magento-cloud environment:branch <branch-name> CLI command.

To apply a custom patch on a Cloud environment, please follow the steps below.

Step 1. In the project root, create a directory called m2-hotfixes if it does not exist. Please run the following command: 

mkdir m2-hotfixes

Step 2. Copy the patch file to the /m2-hotfixes directory. All patch file names must end with the .patch extension

Step 3. Add, commit, and push code changes:

git add -A
git commit -m "Apply patch"
git push origin 


      • Related Articles

      • How to apply a patch?

        A “patch” is a compact representation of the differences between files, intended for use with line-oriented text files. It describes how to turn one file into another, and is asymmetric: the patch from file1 to file2 is not the same as the patch for ...
      • How to apply a patch to avoid overwriting modified files when updating the module?

        Magento allows adding patches to Composer in order to prevent modifications from being overwritten while updating the extension. To apply the patch using Composer, follow the guidelines below. Please note that this instruction works only for patches ...
      • How to revert a patch?

        A “patch” is a compact representation of the differences between files, intended for use with line-oriented text files. It describes how to turn one file into another, and is asymmetric: the patch from file1 to file2 is not the same as the patch for ...
      • How to translate a Magento 2 extension?

        Generally, an extension consists of specific elements (i.e. interface, settings display, added content) which can be translated to another language. When making a translation, as the first step, look through the module's elements in the Admin panel — ...
      • Triggers found by SWAT report

        In Magento 2, for all changes in existing entities to properly reflect in the environment, a reindex is required. Specific events that enforce the reindexing process after changes in database tables are called triggers. Amasty modules do not add ...