1

How do I add the value of an order attribute to the New Order Email template. Specifically an attribute called delivery_date stored in sales_order_grid.

I tried to reverse engineer how {{var order.getShippingDescription()}} works but with no success.

EDIT: I should add that another method I tried was by editing the Email Templates...

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

...and adding this line to it.

$deliverydate = $order->getDeliveryDate()

(Hoping that I could grab the data the same way that I'd grab a Product Attribute). But that method also returned no value.

  • IS delivery_date the field of sales_order table? – Amit Bera Mar 20 at 13:43
  • Yes, delivery_date is also in the sales_order table – Craig Mar 20 at 14:04
0

you should use the email_order_set_template_vars_before event.

write an observer for the event and add you desired data. then in the email template you have to add the data.

  • Please, can you elaborate on that? – Craig Mar 20 at 14:02
  • @Craig done. it's pretty simple – Philipp Sander Mar 20 at 14:08
  • Ok, I'll look into into it - Cheers – Craig Mar 20 at 14:11

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.