Apply patches

We strongly recommend that you test all patches in a staging/development environment before deploying to production. We also strongly recommend that you back up your data before applying a patch.

See the below instructions to learn how to apply a patch to the Connector on both Cloud and non-Cloud environments.

For information about installing or upgrading the Connector see the Install or upgrade the Connector topic.

Intended audience

The audience for this topic is anyone who wishes to patch their Connector for their Magento installation. You should be fairly technical, understand Git commands, and be able to navigate the Magento file system.

Prerequisites

To use OMS and the Connector with Magento v2.3, you must disable Multi-source Inventory (MSI).

Requirements

To get started installing or upgrading the Connector you must have a Connector installed in your non-Cloud or Cloud environment.

On non-Cloud environment

The below method illustrates one way to apply a Connector patch to a non-Cloud environment. Your installation and processes may vary.

To apply a patch to your Connector for your non-Cloud environment:

  1. Upload the patch to the Magento_root directory using FTP, SFTP, SSH, or your normal transport method.

  2. Login to the server as the Magento admin user and verify the file is in the correct directory.

  3. See which files will be changed by the patch:

    git apply --stat patch_file_name.patch
    
  4. Ensure the patch has no associated errors:

    git apply --check patch_file_name.patch
    
  5. Apply the patch:

    git am --signoff < patch_file_name.patch
    

    The command assumes the file to be patched is located relative to the patch file.

  6. Additionally, you can manually see files updated by the patch, and check the state of the patch installation, via your CLI.

  7. Refresh the cache in the Admin under System > Tools > Cache Management to reflect your changes.

    Alternatively, the patch can be applied locally with the same command, then committed and pushed normally.

On Cloud environment

To apply a patch to your Connector for your Cloud environment:

  1. Pull the latest changes from GitHub for your target branch.
  2. In the command line interface (CLI), add the patch file to the m2-hotfixes directory, which is in the root directory of your Cloud instance:

    git add m2-hotfixes/patch_file_name.patch
    

    The command assumes the file to be patched is located relative to the patch file.

  3. Commit your changes:

    git commit -m "Your commit message"
    
  4. Commit your work and push your changes (your patch):

    git push remote_name local_branch_name:remote_branch_name
    

    The patch will be applied during the Cloud update after your git push. See more about upgrading the Connector on a Cloud environment in our Install or upgrade the Connector topic.

  5. Check the state of the patch installation, and files updated by the patch, in one of three ways: