How override name.phtml file for shipment Magento 2.4
-
12-05-2021 - |
Question
I want to add my cusotm code in Magento_Sales::items/column/name.phtml
file
i also created the following XML file
sales_order_creditmemo_new.xml,
sales_order_creditmemo_updateqty.xml,
sales_order_creditmemo_view.xml,
sales_order_invoice_new.xml,
sales_order_invoice_updateqty.xml,
sales_order_invoice_view.xml,
sales_order_view.xml
but it's not work for ship
can anybody help me out?
Solution
You need to override adminhtml_order_shipment_view.xml file to call custom name.phtml file
app\code\VendorName\ModuleName\view\adminhtml\layout\adminhtml_order_shipment_view.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="column_name">
<action method="setTemplate">
<argument name="template" xsi:type="string">
VendorName_CompanyName::items/column/name.phtml
</argument>
</action>
</referenceBlock>
</page>
Now, Need to create name.phtml file on this below path. You can copy file from vendor/magento/module-sales/view/adminhtml/templates/items/column/name.phtml and paste that file on below path. Then, you can add your changes
app\code\VendorName\ModuleName\view\adminhtml\templates\items\column\name.phtml
Now, clean cache and check it.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange