I am creating a webhook that is triggered for the ‘orders/paid’ topic. From there, I add the order to an internal ERP, which returns some fields for the order. I am adding these fields to the ‘note_attributes’ parameter of the order using the Admin REST API. However, I need to include these fields before the order confirmation email is sent. Is it possible to achieve this?
1 Like
In Shopify, the order confirmation email is typically sent after the order has been processed and confirmed. Unfortunately, Shopify does not provide a built-in way to customize or delay the sending of confirmation emails directly.
However, you can work around this.
Here’s a suggested approach:
-
Create a Draft Order:
- When the webhook for ‘orders/paid’ is triggered, instead of immediately updating the existing order, create a draft order using the Admin REST API.
- Add the necessary note attributes to this draft order.
-
Send Confirmation Email for Draft Order:
- After adding the note attributes, you can manually trigger the order confirmation email by marking the draft order as completed using the Admin REST API.
This way, you have control over when the confirmation email is sent because you control when the draft order is marked as completed.