--- title: orderEditSetQuantity - GraphQL Admin description: >- Sets the quantity of a line item on an order that's being edited. Use this mutation to increase, decrease, or remove items by adjusting their quantities. Setting the quantity to zero effectively removes the line item from the order. The item still exists as a data structure with zero quantity. When decreasing quantities, you can optionally restock the removed items to inventory by setting the `restock` parameter to `true`. Learn more about [editing workflows for existing orders](https://shopify.dev/docs/apps/build/orders-fulfillment/order-management-apps/edit-orders). api_version: unstable api_name: admin source_url: html: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/orderEditSetQuantity md: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/orderEditSetQuantity.md --- # order​Edit​Set​Quantity mutation Requires `write_order_edits` access scope. Sets the quantity of a line item on an order that's being edited. Use this mutation to increase, decrease, or remove items by adjusting their quantities. Setting the quantity to zero effectively removes the line item from the order. The item still exists as a data structure with zero quantity. When decreasing quantities, you can optionally restock the removed items to inventory by setting the `restock` parameter to `true`. Learn more about [editing workflows for existing orders](https://shopify.dev/docs/apps/build/orders-fulfillment/order-management-apps/edit-orders). ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) required The ID of the [calculated order](https://shopify.dev/api/admin-graphql/latest/objects/calculatedorder) or the order edit session to edit. The edit changes the quantity on the line item. * line​Item​Id [ID!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) required The ID of the calculated line item to edit. * quantity [Int!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/Int) required The new quantity to set for the line item. This value cannot be negative. * restock [Boolean](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/Boolean) Whether or not to restock the line item when the updated quantity is less than the original quantity. * location​Id [ID](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) Deprecated *** ## Order​Edit​Set​Quantity​Payload returns * calculated​Line​Item [Calculated​Line​Item](https://shopify.dev/docs/api/admin-graphql/unstable/objects/CalculatedLineItem) The calculated line item with the edits applied but not saved. * calculated​Order [Calculated​Order](https://shopify.dev/docs/api/admin-graphql/unstable/objects/CalculatedOrder) The calculated order with the edits applied but not saved. * order​Edit​Session [Order​Edit​Session](https://shopify.dev/docs/api/admin-graphql/unstable/objects/OrderEditSession) The order edit session with the edits applied but not saved. * user​Errors [\[User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/unstable/objects/UserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### orderEditSetQuantity reference ## Mutation Reference ```graphql mutation orderEditSetQuantity($id: ID!, $lineItemId: ID!, $quantity: Int!, $restock: Boolean) { orderEditSetQuantity(id: $id, lineItemId: $lineItemId, quantity: $quantity, restock: $restock) { calculatedLineItem { # CalculatedLineItem fields } calculatedOrder { # CalculatedOrder fields } orderEditSession { # OrderEditSession fields } userErrors { field message } } } ``` ## Input ##### Variables ```json { "id": "gid://shopify//10079785100", "lineItemId": "gid://shopify//10079785100", "quantity": 1, "restock": true } ```