Correct way to change core module code
-
14-04-2021 - |
Question
I have one line of code in a core module (contact) in which I need to change. What is the correct way to make the change to change/overwrite this file?
Solution
There are two ways to do that:
- You can use composer patches to change file (https://github.com/cweagans/composer-patches)
- Use around plugin to override specific public method on a class. (https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html)
OTHER TIPS
You can override using magento plugin concept or simply override concept using preferences
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange