Even in the constant growth of technology and advancement, Email remains one of the most powerful tools for businesses to get in touch with their customers. For Ecommerce orders, it plays a vital role to inform and communicate with the customer in a cost-effective way. And, the order confirmation is one of it, which is used to provide store order placement acknowledgment to your customers to prevent miscommunication. It emphasizes customer relationships and provides more clear information regarding their transactions in your Magento 2 store.
Generally, these emails can be manipulated from the Magento backend. But you can change and update content or design, you can’t add dynamic value inside the mail. To include dynamic value inside your email template, you have to add your custom parameter too. So, here is three steps guide that will help you to add custom parameters in Customer Order Email of Magento 2.
First, you need to create “events.xml” file inside your extension folder.
app\code\Vendor\Extension\etc\events.xml

After that, you need to create “Emailtemplatevars.php” file using below code inside that file. In this file, you can add one or more parameters.
app\code\Vendor\Extension\Observer\Emailtemplatevars.php

After that you need to create “order_new.html” file inside your extension folder and add below code inside that file.
app\design\frontend\Themes\Yourtheme\Magento_Sales\email\order_new.html

That’s it. You are free to manipulate this code according to your need of adding one or more parameters inside the order confirmation mail of Magento 2 or you can use our ready-made Magento 2 order confirmation email.
Lastly, if you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends and Let us know if you are facing any issues while implementing this code.
Happy Coding!

Click to rate this post!
[Total: 14 Average: 4.5]