Doing some work with Returns at the moment and ran into some issues with the GraphQL Admin API when querying an order for existing returns. It seems that currently there is no way to get any LineItem specific information from the return line item like the name, image etc.
Not sure if I am missing something here that would provide a way to get this information, but at least from what I can see this appears to be a gap in the GraphQL Admin API.
What’s even stranger is that an ExchangeLineItem does include a connection to the LineItem.
Hey - I asked the .dev assistant about this, and it says ReturnLineItemType does indeed have a connection to the LineItem through the fulfillmentLineItem field, which allows you to access LineItem -specific details such as the name. Can you test this on your side? It would look something like:
query GetReturnDetails {
return(id: "gid://shopify/Return/945000954") {
status
name
order {
id
}
returnLineItems(first: 10) {
edges {
node {
fulfillmentLineItem {
lineItem {
name
image {
originalSrc
}
}
}
quantity
returnReason
returnReasonNote
}
}
}
}
}
Apparently this query retrieves the status and name of a return, along with the first 10 returnLineItems. For each returnLineItem, it fetches the associated LineItem’s name and image through the fulfillmentLineItem field.
If you are encountering issues accessing this information, ensure that your app has the required read_returns access scope and that the fulfillmentLineItem field is populated for the ReturnLineItemType.