In the REST API (Order - REST), we used to be able to query by “attribution_app_id=current” to retrieve orders that we created by our custom app.
In GraphQL (orders - GraphQL Admin) it looks like we are not able to do that anymore. I have tried using channel_id or source_name in GraphQL but they don’t seem to be working.
Are there any other ways of retrieving orders created by our custom app in GraphQL?
Hey,
It looks like you’re trying to filter orders created by your custom app using GraphQL, but you’re running into some issues with using attribution_app_id
directly like you could in the REST API. I totally get that this can be frustrating!
In GraphQL, you won’t find a direct equivalent of attribution_app_id=current
as you did in REST. The way data is structured in GraphQL can be a little different, and certain filters might not work in the same way.
To retrieve orders created by your custom app, try looking into the source_name
or channel_id
, but if that is not working kindly check the below steps:
- Check Order Attributes: You could try querying the order’s
source_name
or any custom field associated with orders created by your app. Sometimes apps mark orders with unique tags or identifiers that can be used for filtering.
- GraphQL Query Example: You could use something like this to search for orders created by your custom app (using
source_name
as an example):
query {
orders(first: 10, query: "source_name:'your_custom_app_name'") {
edges {
node {
id
createdAt
sourceName
...otherFields
}
}
}
}
- Check Custom Fields or Tags: If your app has custom fields or tags attached to the orders, you can also filter by those, as sometimes these custom identifiers are set up during order creation.
If still none of these options work, it may be best revisiting how your app is tagging or identifying orders and how that information can be retrieved through GraphQL.
Let me know if you need any more help
The source_name filter doesn’t seem to work. I added the field sourceName to the note and saw that it returned “51806209” (which is our App ID). However, when I specified source_name:51806209 in the filter, 0 records were brought back.
I just found the answer here: Where can I find the order.source_name in the Graphql API? - Shopify Community
It looks like you can filter by sales_channel (instead of channel_id or source_name). Just use your AppID for the sales_channel in the query and you will get all the orders created by your custom app.
1 Like