How can I override the Tax.php file at vendor/magento/module-tax/Block/Sales/Order/Tax.php?
I've tried di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Tax\Block\Sales\Order" type="DigitalStartup\EmailTax\Tax" /> </config>
But I get the error:
Class 'Magento\Tax\Block\Sales\Order\Tax' not found in vendor/magento/module-sales/Block/Adminhtml/Order/Totals/Tax.php.
What do I need to use to override the file?
Thank you.
@Sanjay Jethva wrote:Hello @christopher_oliver
It seems as if you have forgotten to add "\Tax" in the section.
Check the location of the di.xml file and make sure that the di.xml file is not located in the adminhtml folder as you are trying to override the file that affects the frontend.I hope it helps
Thanks for the info, much appreciated!