0

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?

2
  • it depends on what type of file you want to modify XML PHP JS? Commented May 19, 2020 at 8:12
  • A php file, in this case post.php
    – Sam
    Commented May 19, 2020 at 17:02

2 Answers 2

0

There are two ways to do that:

  1. You can use composer patches to change file (https://github.com/cweagans/composer-patches)
  2. Use around plugin to override specific public method on a class. (https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html)
1
  • the plugin option should have the higher prio if possible Commented May 20, 2020 at 7:16
0

You can override using magento plugin concept or simply override concept using preferences

Your Answer

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

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