1

I want add custom attribute value in new order email template.

Please help me in this.

1

If the name of the attribute is the following:

your_attribute

Just modify the following template:

/vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml

with copying to:

/app/design/frontend/XXXX/YYYY/Magento_Sales/templates/email/items/order/default.phtml

and insert the following statement to show the variable in the email:

<?php echo $this->escapeHtml($_item->getProduct()->getData('your_attribute')); ?>

tested with M2.3.4

0

If it's a static string you can do this in your transactional email template

https://docs.magento.com/m2/ce/user_guide/marketing/variables-custom.html

0

You can the value of custom attribute in the order email using the following code:

{{trans "%custom_attribute" custom_attribute=$order.getCustomAttribute()}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.