I have been working with Magento2 for a while now (Magento 2.0.9 EE to be specific).

As some of you might already know Magento2 has a lot of bugs (irrelevant of the version you are on), and we have been getting a lot of patches from Magento Support in order to fix those issues (as we used to get in case of Magento1 bug fixes).

Now the problem here is that we have a composer install of Magento2, means no core files are been committed to the GIT repository of the project. So we have to manually apply the patches on the each of the servers (LIVE, STAGING, UAT, DEVELOPMENT etc).

I am looking for any workflow, suggestions, ideas or script that can help me automate this process to that we don't have to manually apply the patches on every server.

1 Answer 1


You can replace entire Magento 2 core packages (modules, theme, other) with composer.

  • Create your own Git repo for each module you patch. I haven't tried with a single Git repository for multiple core modules like module-catalog and module-sales in the same Git repository (it could potentially work).
  • Add the url of your Git repo in repositories (before repo.magento.com) section in composer.json from Magento 2 install.
  • Add in require the module names you patch '"magento/module-{name of the module you patch}": "{exact version}" immediately after ""magento/product-enterprise-edition": "{version}".
  • Delete from vendor/magento/ the modules directories you patch so composer can add the new packages (your Git repositories)
  • Make sure you update composer (itself). It won't work with old versions.

    composer selfupdate --snapshot

  • Finally, run composer update -vvv

This works, try it repeatedly until it works for you. Try using composer clear-cache https://getcomposer.org/doc/03-cli.md#clear-cache if you get stuck. The steps above won't work if you don't update composer and delete original directories of Magento 2 core modules from vendor/magento/

You can do the same with modules of extensions (that have multiple modules) from github, packagist.org, ..

  • What should you do when one of those Magento core packages is updated? What's the best way to keep your repository/repositories up to date?
    – Agop
    Oct 10, 2016 at 12:53
  • @Agop I don't understand your question. You don't have to add all from vendor/magento to your own Git repos. On upgrades to next Magento 2 version, if the module is already patch than you don't use anymore that Git repo (specifically made for 1 core module) in your composer.json. My answear is how to add patches to bugs to a Magento 2 version that you already use, like 2.0.9. There are a few bugs that you'd want to see fixed even if it means modifiying Magento 2 core modules. Usually you pick the patches from Github issues or Magento 2 support team (not talking about security patches MDVA). Oct 10, 2016 at 17:47
  • That's exactly what I was asking. It sounds like the answer is, as long as the updated Magento version includes the patch that you applied, you simply disregard your repository at that point.
    – Agop
    Oct 10, 2016 at 22:34
  • Say you have Magento 2.0.4 and you want to apply a fix on module-catalog. Copy module-catalog code from Magento 2.0.4 into own Git repo (has only module-catalog). Include it in composer.json from magento root dir as described above. When Magento 2.0.5 is out it has other original module-catalog code modifications. Update your Git repo with the code and reapply the patch. Do this with some Git magic (your magic). Note that you need to tag the last commit with current module-catalog version. Magento 2.0.6 is out and it has your patch. Don't need your Git repo anymore. Remove from composer.json Oct 11, 2016 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.