Hello Magento Friends,

In this Magento 2 tutorial guide, I will explain How to Add Comments to Order Programmatically After Place Order from Frontend in Magento 2.

In Magento 2, the ability to add comments or notes to an order programmatically after it has been placed from the front end can be quite useful for various purposes, such as providing additional instructions, clarifications, or internal communication.

Let’s see How to Add Comments to Order Programmatically After Place Order from Frontend in Magento 2.

Steps to Add Comments to Order Programmatically After Place Order from Frontend in Magento 2:

Step 1: Create a file at app\code\Vendor\Extension\etc\events.xml and add the below code.

Step 2: Create a file at app\code\Vendor\Extension\Observer\OrderObserver.php and add the below code.

Output:

Go to the order view page on the front end, where you should now see a comment form. Add a comment and click the “Submit Comment” button. The comment should be added to the order’s status history.

Add order comments

Conclusion:

By following these steps, you can enhance your store’s communication and organization by enabling the addition of comments or notes to orders. This functionality can be particularly helpful for keeping track of special instructions, updates, or any other relevant information associated with each order. You can also use Magento 2 Order Comments Extension to allow customers to add a comment at the checkout page and manage it successfully from the backend.

Share the tutorial with your friends and stay in touch with us for Magento solutions.

Happy Coding!

Click to rate this post!
[Total: 10 Average: 1]