How to Add Quantity Field in Invoice Total in Magento 2 Admin Panel

How to Add Quantity Field in Invoice Total in Magento 2 Admin Panel

Magento 2 store owners are responsible for maintaining the professional standards and delightful customer experience to stay ahead of the competition.

As a part of it, updating customers about their order details, shipping status, invoice documents, credit memo, etc. is important.

An invoice is a legal document that reflects the transaction between buyer and seller. For E-commerce store owners, an invoice must be as detailed as possible that covers essential information a customer must know.

The default Magento 2 invoice includes details like subtotal, shipping and handling charges, tax, and grand total under “Invoice Totals” as shown here:

Default Invoice Total in Magento 2 Admin Panel

However, one may want to add quantity field in invoice total in Magento 2 admin panel which is an important detail to be included in the invoice PDF.

The below programmatic solution allows to do so!

Method to Add Quantity Field in Invoice Total in Magento 2 Admin Panel:

      1. Create registration.php file at app\code\Vendor\Module directory

      2. Create module.xml file at app\code\Vendor\Module\etc directory

      3. Create sales_order_invoice_new.xml file at app\code\Vendor\Module\view\adminhtml\layout

      4. Create Qty.php file at app\code\Vendor\Module\Block\Sales\Order

Once done, the quantity is listed under “Invoice Totals” as shown here:

Add Quantity Field in Invoice Total in Magento 2 Admin Panel

Improve the invoice PDF with the above solution in Magento 2 store.

Any doubts about the method can be mentioned in the Comments section below. I’d be happy to help you out.

Also, do share the solution with Magento Community via social media.

Thank you.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

5
(based on 13 Reviews)

Kanchi is a Magento Developer at Meetanshi. Apart from that, she is into dancing. In her free time, she likes to make handmade art and craft.

4 comments On How to Add Quantity Field in Invoice Total in Magento 2 Admin Panel

  • Hi, this is a nice solution. The only thing is that I get the notification that the block is invalid. (Using Magento 2.2.4). Do you know what might be the problem?

    • Hello,
      Thank you for the appreciation,
      Please check the path of block or name of the class whether it’s proper or not, there might be some mistake.
      Thank You

      • Hi Sanjay,

        I have checked everything but I’m still getting the “Invalid Block type: VendorModuleBlockSalesOrderQty” error.
        I wonder what could be the problem. Just in order to avoid errors in typing I have used the exact naming as in the above (namespaces and directories).
        What am I missing here? Could you advise me?
        Thanks in advance

Leave a reply:

Your email address will not be published.