How to identify return with restocked items?

Hello,

I’m trying to identify order with a return does it have any restocked items and currently can’t find anything that will help me identify this. Here is the sample GraphQL:

query order {
  order(id: "gid://shopify/Order/6020914938115") { #return w/restock
    name
    tags
    createdAt
    currencyCode
    customer {
      email
    }
    returns(first:10) {
      nodes {
        id
        #exchangeLineItems # empty in both cases
        name
        order {
          id
          restockable # true in both cases
        }
        returnShippingFees {
          id
          amountSet {
            presentmentMoney {
              amount
              currencyCode
            }
          }
        }
        status
        reverseFulfillmentOrders(first:10) {
          nodes {
            id
            status
            lineItems(first:10) {
              nodes {
                id
                fulfillmentLineItem {
                  id
                  lineItem {
                    sku
                    name
                    variant {
                      barcode
                      sku
                    }
                  }
                }
              }
            }
          }
        }
        returnLineItems(first:10) {
          nodes {
            id
            quantity
            customerNote
            returnReason
            returnReasonNote
            refundableQuantity
            refundedQuantity
          }
        }
      }
    }
    refunds {
      id
      orderAdjustments(first:10) {
        nodes {
          amountSet {
            shopMoney {
              amount
            }
          }
        }
      }
      transactions (first:10) {
        nodes {
          gateway
          amountSet {
            shopMoney {
              amount
            }
          }
        }
      }
      totalRefundedSet {
        shopMoney {
          amount
        }
      }
      refundLineItems(first:100) {
        edges {
          node {
            location {
              id
            }
            lineItem {
              sku
              variant {
                barcode
              }
              originalUnitPriceSet {
                shopMoney {
                  amount
                }
              }
              discountedUnitPriceSet {
                shopMoney {
                  amount
                }
              }
            }
            quantity
            subtotalSet {
              shopMoney {
                amount
              }
            }
          }
        }
      }
    }
  }
}

I executed same request for two orders with returns: one with item restocked and another one without. They looks pretty identical.

1 Like