Skip to content

Instantly share code, notes, and snippets.

View centerax's full-sized avatar
✈️

Pablo S. Benitez centerax

✈️
View GitHub Profile
@erikhansen
erikhansen / README.md
Last active February 28, 2023 13:59
Patch Magento 2 extension that must be installed in app/code

See also this alternative approach: https://gist.github.com/cmtickle/8900629447429126ffd7ff84e56ec780#to-patch-code-in-appcode

If you need to patch an M2 extension that isn't available to be installed via Composer, and you're concerned about losing edits directly to files in app/code/<Vendor> directory, you can install and then patch the extension locally using these steps:

  1. Copy the extension into an arbitrary folder location like app/code/packages/VendorName/ModuleName (this assumes this module has a composer.json file with the package name of vendorname/module-modulename)

  2. Run this command to add your custom package location to the composer repositories list:

    composer config repositories.vendorname/module-modulename path app/packages/VendorName/ModuleName
    
  3. Require the extension:

#!/bin/sh
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014-2019, Alfred Klomp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: