Skip to main content
  1. Posts/

Drupal 8: Applying Patches with Composer

·53 words·1 min·
Drupal Composer Drupal 8 Drupal Development

How to apply and manage patches with composer.

First add the library ‘cweagans/composer-patches’ to your composer.json

Then under installer-paths in your composer.json add “patches”.  “Patches” is then organized by modules.  Here is an example:

        "installer-paths": {
        },
        "patches": {
          "drupal/commerce_shipping": {
                "Commerce Shipping - Deleted Profile Error": "https://www.drupal.org/files/issues/2018-06-15/commerce_shipping-deleted-profile-error-2969540-6.patch",
                "Patch Label": "https://path-to-patch'
            }
        }
Michael Michalak
Author
Michael Michalak
Experienced Drupal consultant and Fractional CTO with over 13 years of expertise in backend development, optimization, and securing Drupal applications, specializing in custom module development, migrations, and enterprise integrations across various industries.