Cannot get createdAt date from the Return object

Hi everyone,

I’m working on calculating total sales using the Orders API and need some help with retrieving return dates. Specifically, when querying the GQL Orders API, the return object doesn’t include the createdAt or updatedAt fields, even though the documentation states that the createdAt field is available and represents “the date and time when the return was created.”

Here’s the relevant snippet from the documentation:

When I query the API, I get this error:

Here’s the query I’m using:

query getOrderReturns($first: Int!, $query: String, $after: String) {  
  orders(first: $first, query: $query, after: $after) {  
    edges {  
      node {  
        id  
        returnStatus  
        cancelledAt  
        totalPriceSet { shopMoney { amount } }  
        currentTotalPriceSet { shopMoney { amount } }  
        originalTotalPriceSet { shopMoney { amount } }  
        subtotalPriceSet { shopMoney { amount } }  
        currentSubtotalPriceSet { shopMoney { amount } }  
        totalRefundedSet { shopMoney { amount } }  
        cancelledAt  
        refunds(first: 10) {  
          createdAt  
          updatedAt  
          id  
          note  
          return { id }  
          totalRefundedSet { shopMoney { amount currencyCode } }  
          refundLineItems(first:10) { nodes { lineItem { id } } }  
        }  
        returns(first: 10) {  
          edges {  
            node {  
              id  
              createdAt  
              name  
              status  
              decline { note reason }  
              totalQuantity  
              returnLineItems(first:10) {  
                nodes {  
                  id  
                  customerNote  
                  quantity  
                  refundableQuantity  
                  refundedQuantity  
                  returnReason  
                  returnReasonNote  
                  fulfillmentLineItem {  
                    id  
                    discountedTotalSet { shopMoney { amount } }  
                    originalTotalSet { shopMoney { amount } }  
                    lineItem { id }  
                  }  
                }  
              }  
            }  
          }  
        }  
      }  
    }  
    pageInfo { hasNextPage endCursor }  
  }  
}

To calculate total sales accurately, I need a way to identify the date a return was initiated. However, I don’t see a return date field in the REST API either.

Does anyone know of another field or workaround I can use to determine the return initiation date? Any help would be greatly appreciated!

Thanks in advance!

As far as I know even when executed as a bulk query you have to query the refund/returns separately to get extra information.

Currently, the created date field for order returns is unavailable in Shopify’s stable GraphQL API versions. However, it is accessible in the unstable API version .

query MyQuery {
  orders(first: 120) {
    nodes {
      id
      returns(first: 120) {
        nodes {
          createdAt
          id
          returnLineItems(first: 10) {
            nodes {
              id
            }
          }
        }
      }
    }
  }
}

Hi Shopify Team,

When can we expect the created_at field to be available in a stable API version for the Return object?

Not having this field is a major concern, as Shopify’s sales reporting heavily relies on return creation dates. Currently, determining when a return was created is a complex process—we have to analyze order events and attempt to map them to returns. Even this method is unreliable, as we’ve encountered cases where an order has a return but no corresponding return_created event.

Without a direct way to retrieve the return creation date, the Return object lacks essential functionality for accurate sales analysis and reporting. Can you provide any updates on when this will be addressed in a stable API version?

1 Like