All things Shopify and commerce
Hey there,
I am working on an integration to pull returns out of Shopify's GraphQL API and I am wanting to pull the SKU of a Return Line Item from the ReturnLineItemTypeConnection.
There is currently not a SKU field or a Line Item connection that I can then gather the SKU for the ReturnLineItem through that way. RefundLineItem do have the LineItem connection but it seems to ReturnLineItem is missing that connection and there is seemingly not a way to gather it.
https://shopify.dev/docs/api/admin-graphql/latest/queries/orders If you look at Returns > returnLineItems you wil l see the available fields:
There is an ID field available however, that returns a value such as gid://shopify/ReturnLineItem/0123456789 which has no way to link back to the LineItem to get the SKU.
Any help would be appreciated to help me get the ReturnLineItem SKU and I am also using API version: 2025-01.
Many thanks,
Solved! Go to the solution
This is an accepted solution.
If anyone is interested this is how I solved this:
query { orders(first: 25, query: "return_status:IN_PROGRESS") { pageInfo { startCursor hasPreviousPage hasNextPage endCursor } nodes { id displayFinancialStatus displayFulfillmentStatus createdAt updatedAt email name returns(first: 20) { nodes { id status name returnLineItems(first: 20) { edges { node { ... on ReturnLineItem { fulfillmentLineItem { lineItem { id sku } } } quantity returnReason returnReasonNote } } } } } } } }
I used the 'on' operator to link it to the fulfilmentLineItem which then you can use to get the related sku & id from the line item. Hope that helps people in the future. Many thanks
This is an accepted solution.
If anyone is interested this is how I solved this:
query { orders(first: 25, query: "return_status:IN_PROGRESS") { pageInfo { startCursor hasPreviousPage hasNextPage endCursor } nodes { id displayFinancialStatus displayFulfillmentStatus createdAt updatedAt email name returns(first: 20) { nodes { id status name returnLineItems(first: 20) { edges { node { ... on ReturnLineItem { fulfillmentLineItem { lineItem { id sku } } } quantity returnReason returnReasonNote } } } } } } } }
I used the 'on' operator to link it to the fulfilmentLineItem which then you can use to get the related sku & id from the line item. Hope that helps people in the future. Many thanks
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025