I just want to introduce another approach that will apply Magento patches, in case your Magento instance isn’t hosted on Adobe’s Cloud infrastructure or can’t be applied as explained in How to apply a composer patch provided by Adobe for some reason.
1. Update your composer.json file
Add a new section “scripts” at the end of your composer.json file and validate your file with composer validate.
1 2 3 4 5 |
"scripts": { "post-install-cmd": [ "patch -p1 < ./patches/MDVA-43395_EE_2.4.3-p1_COMPOSER_v1.patch" ] } |
If you see ./composer.json is valid you are good to move on. Btw. your composer.lock file doesn’t need to be updated.
2. Create a folder ./patches/
Create a folder ./patches/ or something similar and copy your *.patch file in there.
3. Test it
Run composer install and wait. Your script and patch should be executed after Generating autoload files just like in the below output.
1 2 3 4 5 6 |
Generating autoload files 98 packages you are using are looking for funding. Use the `composer fund` command to find out more! > patch -p1 < ./patches/MDVA-43395_EE_2.4.3-p1_COMPOSER_v1.patch patching file vendor/magento/module-email/Model/Template/Filter.php patching file vendor/magento/framework/Filter/DirectiveProcessor/VarDirective.php |
4. Deploy it
Commit your changes ( composer.json and ./patches/ ) folder and run your deployment procedure.
That’s it!