Having a bit of trouble figuring this one out. When an App is installed I register fulfilment/create & fulfilment/update webhooks, which upon fulfilment changes updates the fulfilment information.
After a fulfilment is created or updated, my endpoint gets called and I update the fulfilment information then & there calling the Shopify API, which sends two emails - one before an update (incorrect) and one after the update (correct).
Is there a way to halt the first email not sending before the fulfilment is updated? For example:
- A fulfilment is created
- Email is not sent to the customer
- Webhook is called
- Webhook updates information
- Email is sent to the customer
Solved! Go to the solution
This is an accepted solution.
This behaviour can be controlled by whatever is creating the fulfillment initially. If the order is being fulfilled through the API, you can send
notify_customer: false in the call which will prevent an e-mail from being sent during fulfillment creation (doc link here). If the order is being fulfilled through the admin, the
Send shipment details to your customer now checkbox can be unchecked to prevent sending an e-mail during fulfillment creation.
Once the behaviour is adjusted during fulfillment creation, you can send
notify_customer: true in your API call to update the fulfillment information, which will send the fulfillment e-mail with the updated information. Please note that different e-mail templates are used when you create a fulfillment (shipping confirmation) vs. when you update a fulfillment (shipping update), so you'll likely need to change the copy on the shipping update e-mail if you'll be using this as the primary shipping notification to the customer.
JB | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution