A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I have been digging deep into the Orders GraphQL object but I can't believe that cartToken is not a field in there - https://shopify.dev/api/admin-graphql/unstable/objects/Order#fields
For my purpose, I am looking up orders from cartTokens. Since I have a lot of cartTokens, I am sending a list of cartTokens as a query parameter as
orders(first: 20, query:"cartToken1 OR cartToken2 OR ...") {...}
And when I get back the response, I have no idea which cartToken is part of which order since not all cartTokens have converted to an order. If only the cartToken was part of the order object. It is sadly part of the REST API but I am unable to query by cartToken in there https://shopify.dev/api/admin-rest/2022-01/resources/order#resource-object
Does anyone have some suggestions? Thanks!
The solution I am thinking of is a little gross:
First fetch list of all order ids from the GraphQL endpoint, then concatenate all the id fields and send it to the REST api's GET /orders endpoint to retrieve the cart tokens.
I prefer this method over all the other terrible ideas I had since this approach at least prevents me from looping over all orders within a date range.