1

i want to add new custom column in Invoice View Page. in Items Invoiced details.

i add code in sales_order_view.xml file but it's not working, the column not addedd.

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>       
       <referenceBlock name="invoice_items">            
          <block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn" 
                 name="cgst"
                 template="Ncode_Test::test.phtml" 
                 group="cgst"/>            
        </referenceBlock>
    </body>
</page>

enter image description here

please help me on this. how can i add custom column in invoice?

1
  • please help me on this
    – rocky9310
    Dec 22, 2021 at 7:54

1 Answer 1

0
your_magento_base/app/code/Magenest/CutomizeOrderInvoice/view/adminhtml/layout/sales_order_invoice_view.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <body>
       <referenceContainer name="content">
           <block class="Magento\Backend\Block\Template"
                  name="magenest_sales_invoice_custom_section" before="sales_invoice_view"
                  template="Magenest_CutomizeOrderInvoice::order/invoice/view/custom_section.phtml">
           </block>
       </referenceContainer>
   </body>
</page>

your_magento_base/app/code/Magenest/CutomizeOrderInvoice/view/adminhtml/templates/order/invoice/view/custom_section.phtml
<section class="admin__page-section">
   <div class="admin__page-section-title">
       <span class="title"><?= $block->escapeHtml(__('Magenest Custom Section')) ?></span>
   </div>
   <div id="invoice_item_container" class="admin__page-section-content">
       <div>
            <p><b>This my section :</b> section custom information</p>
           <strong>Copyright © by Magenest</strong>
       </div>
   </div>
</section>

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.