- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2021
05:46 AM
05-20-2021
05:46 AM
Override module-tax\Block\Sales\Order\Tax.php
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.
Labels:
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2021
10:35 PM
05-23-2021
10:35 PM
Re: Override module-tax\Block\Sales\Order\Tax.php
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
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.
200+ Magento 2 Extensions for Enhanced Shopping Experience.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2021
02:42 AM
05-28-2021
02:42 AM
Re: Override module-tax\Block\Sales\Order\Tax.php
@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!