0

I want to override these two files in a module:

Block:

/magento/vendor/magento/module-sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php

Template:

/magento/vendor/magento/module-sales/view/adminhtml/templates/order/create/shipping/method/form.phtml

How can I do that?

Thanks!

1
  • Do you want to override file in your custom module? May 15, 2018 at 10:54

2 Answers 2

1

For Block use the below code in your module's 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\Create\Shipping\Method\Form" type="[VendorName]\[ModuleName]\Block\Adminhtml\Order\Create\Shipping\Method\Form"/>
</config>

For phtml override create a xml file with name sales_order_create_load_block_shipping_method.xml on your module's layout folder and set template for this "order.create.shipping.method.form" and use your template file location as per the requirement.

1

For block file.

app/code/[VendorName]/[ModuleName]/Block/Adminhtml/Order/Create/Shipping/Method/Form.php

And for html file.

app/code/[VendorName]/[ModuleName]/view/adminhtml/templates/order/create/shipping/method/form.phtml

This will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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