2

Apologies for the long question but I wanted to include all of the various things we've tried.

TLDR: for some reasons, no API call lets us access a Shopify store's returns. The same API calls work for a different store, and different platforms are using the API to get returns out of this store, but nothing works for us on this store in particular.

  • We are querying Shopify's GraphQL Admin API for order returns, but the returns field always returns an empty array (edges: [], nodes: []).
  • We know for a fact that returns exist for some orders in our store.
  • We have verified that DataExport.io successfully retrieves return data from our store.
  • Refunds (order.refunds) return data correctly, but returns does not.
  • We have the correct read_returns API permission.

Debugging Steps We Have Tried

Step 1: Verified the returns Field Exists in GraphQL We ran the query:

graphql
{
    __type(name: "Order") {
        fields {
            name
        }
    }
}

This returned { name: "returns" }, (amongst others) confirming that returns is a valid field inside the Order object.

Conclusion: The API should support returns.

Step 2: Checked API Permissions

We ran:

graphql
query {
    currentAppInstallation {
        accessScopes {
            description
            handle
        }
    }
}

This confirmed that the app has the read_returns permission.

Conclusion: Lack of permissions is NOT the issue.

Step 3: Tried Fetching Returns for a Specific Order

We tested a query like this:

graphql
query GetOrderReturns {
    order(id: "gid://shopify/Order/5567623526582") {
        id
        returns(first: 50) {
            edges {
                node {
                    id
                    status
                }
            }
        }
    }
}

Result: { "returns": { "edges": [] } } → No returns, even though we know they exist.

Conclusion: Shopify is not returning return data inside order.returns.

Step 4: Verified refunds Returns Data

Since refunds and returns are different, we tested:

graphql
query {
    order(id: "gid://shopify/Order/5567123556582") {
        id
        refunds(first: 5) {
            edges {
                node {
                    id
                    totalRefundedSet {
                        shopMoney {
                            amount
                        }
                    }
                }
            }
        }
    }
}

Result: Refunds successfully returned data.

Conclusion: The API is working for refunds, but returns remains empty.

Step 5: Tested a More Comprehensive Query

We expanded our GraphQL request to ask for every possible return-related field:

graphql
query GetOrderReturns {
    order(id: "gid://shopify/Order/556763556582") {
        id
        returns(first: 5) {
            edges {
                node {
                    id
                    status
                    returnLineItems(first: 50) {
                        edges {
                            node {
                                id
                            }
                        }
                    }
                    refunds(first: 5) {
                        edges {
                            node {
                                id
                            }
                        }
                    }
                }
            }
            nodes {
                id
                status
                returnLineItems(first: 5) {
                    edges {
                        node {
                            id
                            quantity
                            refundableQuantity
                            refundedQuantity
                            returnReason
                        }
                    }
                }
                refunds(first: 5) {
                    edges {
                        node {
                            id
                            createdAt
                            totalRefundedSet {
                                shopMoney {
                                    amount
                                }
                            }
                        }
                    }
                    nodes {
                        createdAt
                        id
                        refundLineItems(first: 5) {
                            edges {
                                node {
                                    id
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Result: Still returned { edges: [], nodes: [] }. Everything else came back correctly.

Conclusion: No returns are being retrieved, even though we asked for all possible fields.

What We Know for Sure

  • Returns exist in Shopify (confirmed via DataExport.io).
  • Returns are part of the GraphQL schema (__type(name: "Order")).
  • We have the correct permissions (read_returns).
  • Returns are never returned (always edges: []).
  • Refunds work fine, but returns do not.
  • Querying returns separately also returns an empty array.
  • REST API does not expose returns.

Conclusion

Every API call we tried was successful, and all data except for returns came back as expected. We're using both Supermetrics and dataexport.io to pull data for this store, so we know for a fact that it's possible to get this data using the API.

0

1 Answer 1

1

Install the GraphQL app on your store and run your query. It's likely that you are exceeding the cost limit of the query and need to break it into smaller parts. The response comes back as empty with no error when I run it from Powershell, but in their app, it will actually tell why the query isn't working.

I have never seen an API silently fail like this. This has been maddening.

Sign up to request clarification or add additional context in comments.

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
No it's fine actually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.