This is my email_template.html
<table class="order-details">
<tr>
<td class="address-details">
<h3>{{trans "Billing Info"}}</h3>
<p>{{var formattedBillingAddress|raw}}</p>
</td>
{{depend order.getIsNotVirtual()}}
<td class="address-details">
<h3>{{trans "Shipping Info"}}</h3>
<p>{{var formattedShippingAddress|raw}}</p>
</td>
{{/depend}}
</tr>
</table>
and in my observer
$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 support@xxx.com',
'order' => $order,
'store'=> $store,
'productName'=> $productName
);
->setTemplateVars($templateVars)
My question is how can i set values of billing info, shipping info and payment method in this email template.
Best Answer
Inject class Renderer used for formatting an order address and some classes for Payment into your constructor.
Add to
$templateVars
:Build the methodes for shippping , billing address and payment:
See a good sample here:
vendor/magento/module-sales/Model/Order/Email/Sender/OrderSender.php
vendor/magento/module-sales/view/frontend/email/order_new.html