Order Confirmation Email Sent Before Metafields Are Added

Hi Shopify Community,

I’m currently facing an issue with the timing of order confirmation emails and metafields. Here’s a detailed description of the problem:

I’m working on a Shopify store where I need to add custom metafields to orders. The workflow is as follows:

  1. Create a Draft Order: A draft order is created.
  2. Add Metafields to Draft Order: On the DRAFT_ORDERS_CREATE webhook event, I add custom metafields to the draft order.
  3. Convert Draft Order to Regular Order: The draft order is converted to a regular order.
  4. Order Confirmation Email Sent: Shopify automatically sends the order confirmation email.

The issue is that the order confirmation email is sent before the metafields are added to the order. When I check the order in the Shopify admin, the metafields are present, but they do not appear in the email. It seems like the email is sent before the metafields are fully attached to the order.

Attempts to Fix- Checked Timing: Verified that the metafields are present in the order after creation.

  • Webhook Handling: Ensured that the ORDERS_CREATE webhook checks and adds metafields if missing.
  • Manual Email: Considered sending the email manually but found no built-in way to disable Shopify’s automatic email.

Has anyone else faced this issue? Is there a way to ensure the metafields are included in the order before the confirmation email is sent? Any advice or workarounds would be greatly appreciated!

Thank you!

I would also like to be able to add Order Metafield values to the Order Confirmation email template (since we collect additional customer delivery information and store it in the Shopify Order this way).

Does Shopify have a way, or a plan, to allow developers to add Order Metafields to the Order Confirmation email template?