2

I am trying to overwrite the core AbstractPdf.php from

vendor/magento/module-sales/Model/order/PDF/AbstractPdf.php

To

app/design/frontend/vendor/projecta/Magento_Sales/Model/order/PDF/AbstractPdf.php

I did flush the cache after, but seems still using the core file, am I missing something? do I need to run some script to make this override works? I did search from any where over the internet, still not clear when I should do. Please help

Thanks!

  • 1
    you can't override any php file inside design folder. for that you need to creare di.xml file under module and then override it – Naresh Rupareliya Dec 5 '19 at 2:15
  • Do I need to run magento command to make it works, if I have the di.xml wrote up? – Paul Fan Dec 5 '19 at 17:19
  • yes you need tu run di:compile command for that – Naresh Rupareliya Dec 5 '19 at 17:23
3

You can not override any php file in your theme. Required to create di.xml file in etc folder of your module.

Check answered how to override.

| improve this answer | |
  • someone said it is protected function, so I cannot override, is that true? so create a custom model with di.xml can solve the problem? – Paul Fan Dec 11 '19 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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