We would like to display these variables in a new email template (which is currently assigned to a orderstate):

Ordernumber, Customername, Order Status & Invoicenumber.

The following code does not work:

{{var order.increment_id}}, {{var customer.name}}, {{trans "%name," name=$order.getCustomerName()}}

1 Answer 1


here is my execute function (observer) any other file code add

You can try as below:

$templateVars = array(
                'store' => $this->storeManager->getStore(),
                'message'   => 'We processed your order ID We will contact you soon in mail for the acknowledgement if you not receive mail within 4 hours please get help from [email protected]',
                'myvar2' => 'myvar2 value come here',
                'myvar3' => 'myvar3 value come here'

In email template email_template.html, use like

{{var myvar2}}
{{var myvar3}}
{{trans "%customer_name" customer_name=$myvar3}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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