orderEditSetQuantity does not restock when reducing the quantity

I was using this code block to try to reduce the order line item quantity:

mutation reduceLineItemQuantity {
  orderEditSetQuantity(id: "gid://shopify/CalculatedOrder/19300374", lineItemId: "gid://shopify/CalculatedLineItem/2941798776854", quantity: 1) {
    calculatedOrder {
      id
      addedLineItems(first: 5) {
        edges {
          node {
            id
            quantity
          }
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

I just copied from the guide here: https://shopify.dev/api/examples/order-editing#edit-line-item-quantity
It worked well for me, but the product quantity did not restock after I’s reduced the quantity.

Is there any way to restock the removed items from orders?

Hey @test6A ,

Had a closer look, and there is an argument restock (boolean) for the orderEditSetQuantity mutation (docs here). This isn’t required, but that will need to included for input and set to TRUE if the intention is to restock the removed item(s).

Our developer and API examples like the one shared, offer an excellent starting point to explore specific functionalities on the platform, but suggest exploring the indepth API documentation for added insights. These include more detailed docs for objects, queries and mutations as well as available fields, arguments, expected values, and connections among other important details. Here is the main page for the Shopify GraphQL Admin API docs.

Hope that offers some clarity!

@awwdam I set the variables input like this:

variables: {
            id: calculatedOrderId,
            lineItemId: `gid://shopify/CalculatedLineItem/${lineItemId}`,
            quantity: quantity,
            restock: true,
          },

But it does not restock either.

@test6A you need to edit query as well like:

mutation orderEditSetQuantity($id: ID!, $lineItemId: ID!, $quantity: Int!, $restock: Boolean!) {
  orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $quantity, restock : $restock) {
    calculatedOrder {
      id
    }
    userErrors {
      field
      message
    }
  }
}

, the problem in you approach is you are setting the variable but using in the query.