Fetching sales returns based on last modified time

I am trying to fetch sales orders and the sales returns associated with the sales orders (using orders graphQL) in an incremental manner using time frame - making an API daily to fetch the orders (and the sales returns associated with them) created/ updated in the day’s time frame.

The issue here is when a sales return is requested or approved, the updatedAt field of the corresponding sales order is not updated. (It is updated only when the sales return is processed). Hence I am unable to fetch the sales orders for updating which have sales returns in approved status. Is there any way to identify and fetch the sales returns which are approved.

1 Like

Hey @Priya,

For tracking return events, the events connection provides precise timestamps for both return creation and processing. You can see exact timestamps like when a return was created ("created return #1488-R2") and when it was processed ("processed 2 items from return #1488-R2").

This is also being improved in API version 2025-07 with the introduction of return processing. The new returnProcess mutation creates proper sales agreements with RETURN reason when you process returns.

Hi @KyleG-Shopify.

Thank you for your response. However it doesn’t solve my case.

I am using the following graphql to fetch sales orders data.

{
  orders(first: 50, query: "updated_at:>2025-07-30T00:00:00Z") {
    nodes {
      lineItems(first: 250) {
        nodes {
          id
          name
          quantity
          sku
          taxable
          variant {
            id
          }
        
        }
      }
      discountCode
      fulfillable
      shippingLines(first: 15) {
        nodes {
          id
          price
          title
          taxLines {
            price
            ratePercentage
            title
            channelLiable
          }
          
        }
      }
      fulfillments(first:10)
      {
        id
        fulfillmentLineItems(first: 50)
        {
          nodes{
            id
            quantity
          }
        }
      }
      
      returns(first: 10) {
        nodes {
          name
          id
          returnLineItems(first: 10) {
            nodes {
              id
              quantity
              ... on ReturnLineItem {
                id
                quantity
              }
            }
          }
        }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
      hasPreviousPage
      startCursor
    }
  }
}

Consider the following scenario

  • I have two orders - Order#1 created and fulfilled on 28 July, Order#2 created on 29 July.

  • A return is raised for Order#1 on July 31 (approved and not yet processed) and a fulfilment is created for Order#2 on July 31.

When I hit API with above query, the result gives only Order#2 in the response and not Order#1. This is because creating fulfilment modifies the updatedAt filed of Sales order, whereas creating or approving a return does not modify the updatedAt field.

I am looking for means to fetch the sales order and return info when a sales return is in approved state, by checking the updatedAt filed.

Thanks for that clarification.

Since the update isn’t changed when a return is created this field isn’t going to work. One alternative is to query all orders that have a return_status of in progress, and then use the return createdAt date to find orders within the range.