Admin api edit order

Topic summary

Main issue: Using the Admin GraphQL API’s orderEditSetQuantity mutation to set a line item quantity to 1 returns an incorrect quantity (3) in the calculatedOrder response.

Observed behavior:

  • When the mutation response selection includes calculatedLineItem (e.g., requesting its id), calculatedOrder then reflects the correct quantity.
  • Without calculatedLineItem in the selection set, calculatedOrder shows the wrong quantity.

Technical context:

  • orderEditSetQuantity updates an order edit draft.
  • calculatedOrder and calculatedLineItem are fields in the mutation response that return the recalculated order and the affected line item, respectively.
  • A code snippet demonstrating the selection set difference is central to understanding the issue.

Current status and actions:

  • The behavior appears to be a potential API bug or inconsistency tied to the response selection set.
  • A support representative requested direct messages with store details and reproduction steps to investigate further.
  • No resolution yet; investigation pending.
Summarized with AI on January 11. AI used: gpt-5.

Hello,

I’m creating a front end application that uses the admin graphQL api. We have a flow where we need to edit existing orders. In order to do that we use the orderEditSetQuantity mutation, however when we want to set the quantity to 1, the quantity returned in the calculatedOrder response is incorrect (it returns 3 but it should be 1). What we noticed though is that if we pass in the calculatedLineItem field in the query, then the response of calculatedOrder then works fine. This seems to be a strange bug with the API. What can I do from here?

sample of our query (quantity here returns 3 even though we pass in 1)

 mutation orderEditSetQuantity ( $id: ID!, $lineItemId: ID!, $quantity: Int! ) {
            orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $quantity) {
                calculatedOrder { 
                      lineItems(first: 50) { 
                            nodes { quantity }
                        } 
                **calculatedLineItem { id }** works when this is present

Thank you,

Tristan

Hey @tristan_vu

Thanks for raising this. Can you please DM me the store details/replication steps?