Magento2 Order email missing custom variable values for first time & when I send email from admin it shows values

Basically this custom variable values are the order attributes.

I have used this email_order_set_template_vars_before event to set the order attribute value in email. Not sure why it comes blank first time

checkout_onepage_controller_success_action is the event from one of my extension to send mail

Please guide

1 Answer 1


This event email_order_set_template_vars_before will not work because the Order email is sent right after the payment event trigger. So try to set the order attribute value on the quote event instead of using the checkout_onepage_controller_success_action event.

  • I have used this function to place order $this->cartManagementInterface->placeOrder() not sure which event will be called after that to set the custom variable for order email
    – Arjun
    Oct 6, 2023 at 6:42

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.