How To Add Order Number To Subject In Order Email Template in Magento 2

So you have made a sale.

Yaay!

But your job is still not done. Conversion is only one side of the equation, you also need to gear up for the post-purchase customer experience.

And how well crafted your order emails are, does matter. A misplaced order email is a lost opportunity.

However, it is not a task that requires any extraordinary efforts. Even small changes like adding order number to the subject line in the order related emails can push significantly towards improving customer experience. Suppose you have set up order confirmation Email in Magento 2 and want to add the order number to the subject line, you can consider this solution.

To add order number to subject in order email template in Magento 2, all you have to do is run the below code:

Method to Add Order Number To Subject In Order Email Template in Magento 2:

{{trans "Your %store_name order confirmation" store_name=$store.getFrontendName()}}  #{{var order.increment_id}}

That’s it.

Implementing such small tactics can contribute to noticeable customer experience improvement.

PS : You can also use custom variables in transaction emails in Magento 2 to optimize order emails!

Hopefully, implementing the above solution will help you with order emails.

Sharing the solution with fellow developers via social media would be a nice thing to do! 

Thank you.

PPS: You can take the game one level up and go for  Magento 2 Email Attachment extension to automate attaching order docs in sales emails.  Just saying

Sanjay Jethva

Article by

Sanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for...