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

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

Magento 2 store admins not only strive to make their store convenient to customers but also continuously implement various tactics to make the store convenient for themselves!

Default Magento 2 provides a user-friendly interface and customization facility for the admin to address their requirements efficiently.

Store admins tend to improve their stores’ admin panel by customizing admin functionalities, adding custom messages, columns, adding filters or removing them in the grid, etc.

One such example that I have mentioned here is to add custom message to admin sales order view, invoice, and credit memo in Magento 2.

For example, you may want to display a custom message when an order contains gift while processing that order from the admin panel.

Check out the below solution for implementing such examples in your store:

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

  1. Create layout files.
  • Method to add a custom message to admin sales order view

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

Create sales_order_view.xml at Vendor/Module/view/adminhtml/layout/

  • Method to add a custom message to the invoice

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

Create sales_order_invoice.xml at Vendor/Module/view/adminhtml/layout/

  • Method to add a custom message to the credit memo

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

Create sales_order_creditmemo.xml at Vendor/Module/view/adminhtml/layout/

2. Now, create customMessage.php at Vendor/Module/Block/Adminhtml/Order/View/

3. Create customMessage.phtml at Vendor/Module/view/adminhtml/templates/order/view

That’s all!

If you have any doubts, just mention them in the Comments section below.

I would be happy to help.

Feel free to 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 4 Reviews)

Krishna is a Magento developer at Meetanshi. She is always ready to learn new things. Apart from work, she likes to read books and spend time with family.

Leave a reply:

Your email address will not be published.