We are using Shopify Flow to update customer metafields after an order is placed. This metafield is essential for validation, so it’s crucial that the update occurs almost instantly to prevent errors if a customer places an order immediately afterward.
I’ve noticed that sometimes it takes a few minutes for the Shopify Flow to execute after an order. Webhooks always seem to be instant. Is there anything we can do in Shopify Flow to ensure it runs nearly instantly? Or should we consider using webhooks in this case? I assume it relates to how you manage the flow executions.
If you need to absolutely control latency you could try a webhook so that you can control the performance. That said, most of the time I see delays, it’s in the webhook being produced. Usually delays on the Flow for a shop can be because the shop is consuming a lot of Flow resources and so the workflow has to wait for others. And that is almost always caused by a badly designed workflow in the shop that is unnecessarily pulling a lot of data.
So I’d recommend reducing your need here for low latency first. If you can’t you do have options.
Thanks Paul. I don’t know how I could reduce the need for latency in my case. It is very unlikely that this occurs, but I’d like to make it as tight as possible.
I have two questions:
Why would the webhook be delayed? Does this mean I would run into the same issue when using a webhook to a custom API endpoint?
Are there any guides on optimising Flow resources? Would that fix this example: order came in 10.16 and the Flow started at 10.18. The execution itself is superfast.
Yes, you can run into the same issue with webhooks. The pipeline can be affected by any number of scenarios. It’s designed to be reliable but that doesn’t mean low latency.
For Flow, we are working to improve observability so this is easier to tell. But it’s possible you have another workflow that is getting data for conditions or in “Get data” that is looping over a lot of data. Like checking order / lineItems / products / collections / product / title. Maybe people do this by mistake but don’t catch it.