I have a 3rd party module installed in my magento. I want to do some modification. I should modify the module directly or write another module to override it? Please advise

  • I think you should always do another module do modify or you'll have problems in the future upgrading it, there is some ways to do it, keep in mind that even if you use preference in the di.xml to extend it can give you some work later since you're basically override the whole file, but at least you know which files you edited and it easier for other to read. Hope it helps, someone with more experience might help more with options to do it, hope it helps
    – Rui Silva
    Nov 23, 2020 at 18:28

2 Answers 2


You should never directly modify any 3rd party modules.

Depending on what you want to modify, you should create your own module that depends on that 3rd party module and inside your own module make the modifications you want.

For example, if you want to modify the output of a method you should use plugins, or if you want to modify a template you should copy the template from the module into your own and do the modifications there.


I think, creating your own repository for the module and do the modifications is the way to go. I am handling some modules like this - especially some modules, that are not available over composer.

If the module is an open-source project, you can do a fork and work with that. And if you are adding some features/functionality, you may can contribute to the project. Some commercial products are also happy to get some help with implementing new stuff.

I dont like "overwriting" files. It is made for breaking stuff in the future. Fork or copy the module and do your thing...

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.