GraphQL Efficiency Question

Shopify Expert
4838 60 589

Lets say I have a specific product in mind that is for sale. A one of a kind. A handle of i-am-special. Now consider a shop having a Flash sale. Perhaps 1000 orders happening over the course of an hour.

I want to ask the API this question. "Hey, is there an order where this product with this handle i-am-special is a line item?

At the moment, I can download N orders that happened, and inspect the line items of each one, looking for a match, but that seems like it would be really slow and primitive to be doing throughout this period of the flash sale.

Is there a convenient way to get the one order that may contain this precious item without downloading all the orders and inspecting each one, over and over again? I know I can download N orders, and build my own lookup table, ensuring I only do an order once, and then I can just inspect that lookup table... but I am sussing out if a GQL option might also be considered.



Custom Shopify Apps built just for you!
Replies 0 (0)