Below is the Block

            <action method="addTab">
                <argument name="name" xsi:type="string">order_history</argument>
                <argument name="block" xsi:type="string">Magento\Sales\Block\Adminhtml\Order\View\Tab\History</argument>

I want to use my block class but not able to change it.

I have tried with below code.

<referenceBlock class="\Mymodule\MyBLock" name="order_history" >

But not working.

Please help


Override that class in your module.

Write this in 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\Sales\Block\Adminhtml\Order\View\Tab\History" type="your\yourmodule\Block\Adminhtml\<your path to your block class>" />

Block class

namespace your\yourmodule\Block\Adminhtml\<your path to your block class>;

class <your class Name> extends \your\yourmodule\Block\Adminhtml\<your path to your block class>

  • Thanks for answer but that I already know but is there any alternate way to achieve this. – Hitesh Agrawal Aug 29 '18 at 9:13

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.