GraphQL API still shows removed line item on order

Hi,

I’m using the Shopify GraphQL Admin API to fetch order details. The issue I’m facing is that when a line item is removed from an order in the Shopify admin panel, it still appears in the GraphQL API response.

Here is GraphQL Query:

query = `
  query GetOrders($cursor: String) {
    orders(first: 100, after: $cursor, query: "id:${ORDER_ID}") {
      pageInfo {
        hasNextPage
      }
      edges {
        cursor
        node {
          id
          name
          createdAt
          updatedAt
          displayFinancialStatus
          currencyCode
          total_price: totalPriceSet {
            shopMoney {
              amount
            }
          }
          purchasingEntity {
            __typename
            ... on PurchasingCompany {
              company {
                id
                name
              }
            }
          }
          refunds {
            id
            createdAt
            totalRefundedSet {
              shopMoney {
                amount
                currencyCode
              }
            }
          }
        }
      }
    }
  }
`;

Response :

{“data”: {“orders”: {“pageInfo”: {“hasNextPage”: false},“edges”: [{“cursor”: “***************”,“node”: {“id”: “gid://shopify/Order/MASKED_ORDER_ID”,“name”: “#MASKED_ORDER_NUMBER”,“createdAt”: “2025-08-22T23:33:38Z”,“updatedAt”: “2025-08-28T18:40:57Z”,“displayFinancialStatus”: “PAID”,“currencyCode”: “USD”,“total_price”: {“shopMoney”: {“amount”: “2270.54”}},“purchasingEntity”: {“__typename”: “Customer”},“refunds”: [{“id”: “gid://shopify/Refund/MASKED_REFUND_ID”,“createdAt”: “2025-08-25T16:26:09Z”,“totalRefundedSet”: {“shopMoney”: {“amount”: “0.0”,“currencyCode”: “USD”}}}]}}]}},“extensions”: {“cost”: {“requestedQueryCost”: 38,“actualQueryCost”: 5,“throttleStatus”: {“maximumAvailable”: 20000,“currentlyAvailable”: 19995,“restoreRate”: 1000}}}}


I have attached a screenshot from the Shopify panel

1 Like

Hey @Data_Team,

The GraphQL Admin API doesn’t currently support filtering out removed line items directly in the query, so they’ll still appear in your response. You can use the currentQuantity field to identify which line items are actually part of the order. When you add line items to your query, you’ll see that quantity shows the original amount ordered, while currentQuantity excludes both refunded and removed units.

lineItems(first: 250) {
  nodes {
    id
    name
    quantity          # Original quantity: 1
    currentQuantity   # Current quantity (excludes removed): 0
  }
}

Hey @Data_Team, does the above help at all?

Hi KyleG,

Yep, that’s really helpful thank you.

1 Like

Hi @KyleG-Shopify,

How can we differentiate between a refunded and removed line item?

The quantity and current_quantity logic is the same for both, I believe.

Hey @DylsD , you’re right that quantity and currentQuantity behave the same whether items are refunded or removed through order editing. To differentiate between them, check the order’s refunds array and the associated OrderTransaction objects.

For context, when items are removed via order edit without a refund, the order will show a balance owing but won’t have refund transactions tied to those specific line items.

The refundDiscrepancySet field on the Order object also exists specifically to track differences between suggested and actual refund amounts, which helps identify these scenarios.

1 Like