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!

3
  • 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 Dec 5, 2019 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, 2019 at 17:19
  • yes you need tu run di:compile command for that Dec 5, 2019 at 17:23

1 Answer 1

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.

1
  • 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, 2019 at 23:33

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.