Query for GraphQL to Fetch "Item Subtotal" in Refund and "Return Item" in Return

Hi everyone,

I’m currently working with Shopify’s API and trying to fetch specific data related to refunds and returns. I need to retrieve the following information:

  1. Item Subtotal for a refund – This is shown as “Item subtotal (1)” in the refund summary.

  2. Return Item for a return – This is shown as “Return item (1)” in the return summary.

Could someone help me with the exact GraphQL query that returns these values for both refund and return operations?

Here’s an example of what I’m trying to retrieve:

  • For refunds, the item subtotal is a value displayed like: $786.00 (under “Item subtotal (1)”).

  • For returns, the return item amount is shown as -$600.00 (under “Return item (1)”).

Thank you for your help!

Hey @Kaitlyn_Trinh :waving_hand: The values you’re looking for live on different types depending on whether you’re dealing with a refund or a return.

For the refund “Item subtotal” ($786.00 in your screenshot), use the order.suggestedRefund query. The subtotalSet field on SuggestedRefund gives you the item subtotal (after any line-level discounts, before the cart/order discount), and totalCartDiscountAmountSet gives the order discount amount shown on that same page.

query SuggestedRefundBreakdown($orderId: ID!, $refundLineItems: [RefundLineItemInput!]!) {
  order(id: $orderId) {
    suggestedRefund(refundLineItems: $refundLineItems) {
      subtotalSet {
        shopMoney { amount currencyCode }
      }
      totalCartDiscountAmountSet {
        shopMoney { amount currencyCode }
      }
      totalTaxSet {
        shopMoney { amount currencyCode }
      }
      refundLineItems {
        quantity
        priceSet {
          shopMoney { amount currencyCode }
        }
        subtotalSet {
          shopMoney { amount currencyCode }
        }
      }
    }
  }
}

Within the refundLineItems array, priceSet is the per-unit original price and subtotalSet is the line total after all discounts are applied. The top-level SuggestedRefund.subtotalSet is the number that maps to “Item subtotal” in the admin.

For the return “Return item” ($600.00 in your screenshot), use the returnCalculate query. The field you want is subtotalBeforeOrderDiscountsSet on each CalculatedReturnLineItem.

query CalculatedReturnBreakdown($orderId: ID!, $returnLineItems: [CalculateReturnLineItemInput!]!) {
  returnCalculate(input: { orderId: $orderId, returnLineItems: $returnLineItems }) {
    returnLineItems {
      quantity
      subtotalBeforeOrderDiscountsSet {
        shopMoney { amount currencyCode }
      }
      subtotalSet {
        shopMoney { amount currencyCode }
      }
      totalTaxSet {
        shopMoney { amount currencyCode }
      }
    }
  }
}

subtotalBeforeOrderDiscountsSet is the return item amount before order-level discounts (your $600.00), subtotalSet is after the order discount is applied, and totalTaxSet gives the tax portion. One thing to watch for is that returnCalculate takes a fulfillmentLineItemId (not a lineItemId), so the items need to be fulfilled first. The amounts also come back as negative values since they represent money owed back to the customer, so you may need to take the absolute value if you’re displaying them.

Hope this helps!

Hi Donal,

Thank you for your detailed explanation and for sharing the queries.

However, I’ve run into an issue during testing. The query does not return a value when the item has already been refunded.

Specifically, the suggestedRefund query only works for items that have not yet been refunded. Once the refund is created, it no longer returns the “Item subtotal” value for those refunded items. Because of this, we’re unable to retrieve the correct “Item subtotal” for existing refunds in Shopify Admin.

Could you please advise if there is any query or field that supports retrieving this value for already-refunded items?

Looking forward to your guidance.

Best regards,
Kaitlyn

You’re right that suggestedRefund only works before a refund is created. It’s a preview tool for calculating what the refund would look like, so once the refund exists it won’t return those values anymore.

For completed refunds, the same subtotalSet field is available on RefundLineItem through the order.refunds path instead.

query CompletedRefundBreakdown($orderId: ID!) {
  order(id: $orderId) {
    refunds {
      id
      createdAt
      totalRefundedSet {
        shopMoney {
          amount
          currencyCode
        }
      }
      refundLineItems(first: 20) {
        nodes {
          quantity
          priceSet {
            shopMoney {
              amount
              currencyCode
            }
          }
          subtotalSet {
            shopMoney {
              amount
              currencyCode
            }
          }
          totalTaxSet {
            shopMoney {
              amount
              currencyCode
            }
          }
          lineItem {
            name
          }
        }
      }
    }
  }
}

Each refund line item’s subtotalSet is the line total for the refunded quantity (after line-level discounts), and priceSet is the per-unit price. For a single-item refund, subtotalSet maps directly to the “Item subtotal” shown in the admin. If the refund covers multiple items, you’d sum the subtotalSet values across all refund line items to get that admin total. The Refund object’s totalRefundedSet is the full refund amount including shipping, duties, and adjustments, so it won’t match the item subtotal alone.

Hope this gets you what you need, let me know if not!