How to add comments into the email order confirmations

How to add comments into the email order confirmations

In order to add the comments that customers insert at the One Step Checkout page into the Email order confirmations, stores’ admin need to do the following steps:

Step 1: Get the order attribute code

  • For the Comment field, we set the attribute code is osc_order_comment

Step 2: Create the email templates

  • Go to Marketing > Communications > Email Template, choose Add New Template (or Edit Template)

order attribute 1

  • Load Email New Order Templates

order attribute2

{{depend order.getOscOrderComment()}}
     <p>{{var order.getOscOrderComment() |raw}}</p>
  • Depend tag is used to check whether that attribute is empty or not. If it is empty, the html part will be eliminated.
  • OscOrderComment is the capital words of each Attribute code.

Step 3: Apply the email template that has been created.

  • Navigate to Stores > Settings > Configuration, choose tab Sales > Sales Emails

  • In New Order Confirmation Template, choose Email Template that you have created.

order attribute3

Step 4: Check the emails again

  • Enable customers to Place Order at Frontend
  • Allow checking the emails that customers received from your stores.

order attribute4

Order Attributes

Order Attributes for Magento 2

Collect more beneficial data by creating custom order attributes

Check it out!

Back Ask Mageplaza

Looking for more information?