Use case: I want to retrieve customers who have ordered a specific product using the Shopify GraphQL API. I’m currently working with Lucee to make this query, but I’m not getting any results
I’ve tested out the query below with the GraphiQL app on my test store and it returns a list of customers who have made orders that contain a product with id 8449274904890 - can you try the same but with your product ID?
Thanks for your reply. I also tested your query before, but it is not working. You can reproduce by editing your product_id to a non existing ID. Also notice that the output has warnings:
“warnings”: [
{
“field”: “line_items.product_id”,
“message”: “Invalid search field for this query.”
}
]
I’ve given some more thought for adding the SKU. I expect that adding a SKU afterward won’t work for existing orders. Therefore, I created a new product with a SKU. When I place an order for this product, I can see my order, including the SKU, in the order overview (admin panel). However, I’m not getting any output from the API, empty array.