cancel
Showing results for 
Search instead for 
Did you mean: 

Including ProductName as a variable inside new order template

Including ProductName as a variable inside new order template

Is there a way to have a variable inside the email template that pulls the product name of the order?

My orders will ever only have one product name, and I need to find a way to print just the product name inside the template. Is this possible?

I'm using Magento 2.3.3

1 REPLY 1

Re: Including ProductName as a variable inside new order template

Hello @brunotruee30c0 

 

It's technically wrong to get product name as variable as any order can have multiple products but the variable will be only able to store one name, so which name it should get ?

I will prefer you to use layout handle to get the data, as you might need to pull all data of order and HTML can't show dynamic data in Email templates, so you can create a layout handle (phtml file) where you can get all the required data and set it in a specific manner which is not possible with only HTML.

Here is is reference to create layout handle for default order email template :

https://gordonlesti.com/magento-2-email-template-layout-directives/

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy