Hello Magento Friends,

In today’s article, I will be providing a solution for Magento 2: Add Custom Message to Admin Sales Order View, Invoice, and Credit Memo.

Customization is the number one feature of Magento 2. Not only the storefront but also the admin panel can be customized as per the requirements. Adding custom elements to the admin panel makes the admin work easy and more understandable.

Admin can add custom columns, elements, messages, and components in the admin grid. It will help the admin efficiently manage and fulfill orders.

Here we will be adding a custom message to the admin sales order view, invoice, and credit memo in the Magento 2 admin grid.

How to Add Custom Message to Admin Sales Order View, Invoice, and Credit Memo in Magento 2?

Step 1: Add custom content in the order summary on the checkout page in Magento 2

Go to the below file path

app\code\Vendor\Extension\view\adminhtml\layout\sales_order_view.xml

Then add the below code

Now navigate to the below file path

app\code\Vendor\Extension\view\adminhtml\templates\order\view\custom_content.phtml

And add your custom content

Next move to the following file path

app\code\Vendor\Extension\Block\Adminhtml\Order\View\ CustomContent.php

Then add the code as follows

Step 2: Add a custom message to the invoice in Magento 2

For that, you need to create an invoice layout file

Go to the below file path

app\code\Vendor\Extension\view\adminhtml\layout\sales_order_invoice_view.xml

Add the code mentioned below

Step 3: Add a custom message to the credit memo in Magento 2

 You need to create a credit memo layout file

Navigate to the below-mentioned file path

app\code\Vendor\Extension\view\adminhtml\layout\sales_order_creditmemo_view.xml

Append the code as follows

Step 4: Run CLI command in Magento 2

Once the above files are created, kindly run the below command

Result:

After performing all the steps successfully, you can see that your custom message is added.

Custom message on Magento 2 Admin sales order view

sales order view custom message

Custom message on Magento 2 invoice

invoice custom message

Custom message on Magento 2 credit memo

credit memo custom message

Conclusion:

Accordingly you can include your custom message in the admin sales order view, invoice, and credit memo in Magento 2.

Add more customization to the admin sales order view with the below elements

Need any further customization for your Magento 2 store? Contact us 

Happy Coding!

Click to rate this post!
[Total: 3 Average: 5]