--- title: inventoryAdjustQuantity - GraphQL Admin description: Adjusts the inventory by a certain quantity. api_version: unstable api_name: admin source_url: html: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/inventoryAdjustQuantity md: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/inventoryAdjustQuantity.md --- # inventory​Adjust​Quantity mutation Requires `write_inventory` access scope. Also: The user must have a permission to adjusts an inventory quantity. Deprecated. Use [inventoryAdjustQuantities](https://shopify.dev/docs/api/admin-graphql/latest/mutations/inventoryAdjustQuantities) instead. Adjusts the inventory by a certain quantity. ## Arguments * input [Inventory​Adjust​Quantity​Input!](https://shopify.dev/docs/api/admin-graphql/unstable/input-objects/InventoryAdjustQuantityInput) required Provides the input fields required to update an inventory level. *** ## Inventory​Adjust​Quantity​Payload returns * inventory​Level [Inventory​Level](https://shopify.dev/docs/api/admin-graphql/unstable/objects/InventoryLevel) Represents the updated inventory quantity of an inventory item at a specific location. * 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 * ### Decrease the available inventory of an item at a location by 2 #### Query ```graphql mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } } ``` #### Variables ```json { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: [\"available\"]) { name quantity } incoming item { id sku } location { id name } } } }", "variables": { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } }`, { variables: { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } } QUERY variables = { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } }`, "variables": { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } }, }, }); ``` #### Response ```json { "inventoryAdjustQuantity": { "inventoryLevel": { "id": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "quantities": [ { "name": "available", "quantity": -1 } ], "incoming": 0, "item": { "id": "gid://shopify/InventoryItem/43729076", "sku": "draft-151" }, "location": { "id": "gid://shopify/Location/124656943", "name": "Shipping Origin" } } } } ``` * ### Increase the available inventory of an item at a location by 3 #### Query ```graphql mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } } ``` #### Variables ```json { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": 3 } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: [\"available\"]) { name quantity } incoming item { id sku } location { id name } } } }", "variables": { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": 3 } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } }`, { variables: { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": 3 } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } } QUERY variables = { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": 3 } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } }`, "variables": { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": 3 } }, }, }); ``` #### Response ```json { "inventoryAdjustQuantity": { "inventoryLevel": { "id": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "quantities": [ { "name": "available", "quantity": 4 } ], "incoming": 0, "item": { "id": "gid://shopify/InventoryItem/43729076", "sku": "draft-151" }, "location": { "id": "gid://shopify/Location/124656943", "name": "Shipping Origin" } } } } ``` * ### inventoryAdjustQuantity reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20AdjustInventoryQuantity\(%24input%3A%20InventoryAdjustQuantityInput!\)%20%7B%0A%20%20inventoryAdjustQuantity\(input%3A%20%24input\)%20%7B%0A%20%20%20%20inventoryLevel%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20quantities\(names%3A%20%5B%22available%22%5D\)%20%7B%0A%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%20%20quantity%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20incoming%0A%20%20%20%20%20%20item%20%7B%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20sku%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20location%20%7B%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22input%22%3A%20%7B%0A%20%20%20%20%22inventoryLevelId%22%3A%20%22gid%3A%2F%2Fshopify%2FInventoryLevel%2F964427794%3Finventory_item_id%3D43729076%22%2C%0A%20%20%20%20%22availableDelta%22%3A%20-2%0A%20%20%7D%0A%7D) ##### GQL ```graphql mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } } ``` ##### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: [\"available\"]) { name quantity } incoming item { id sku } location { id name } } } }", "variables": { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } } }' ``` ##### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } }`, { variables: { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } }`, "variables": { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } }, }, }); ``` ##### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation AdjustInventoryQuantity($input: InventoryAdjustQuantityInput!) { inventoryAdjustQuantity(input: $input) { inventoryLevel { id quantities(names: ["available"]) { name quantity } incoming item { id sku } location { id name } } } } QUERY variables = { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "input": { "inventoryLevelId": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "availableDelta": -2 } } ``` ## Response JSON ```json { "inventoryAdjustQuantity": { "inventoryLevel": { "id": "gid://shopify/InventoryLevel/964427794?inventory_item_id=43729076", "quantities": [ { "name": "available", "quantity": -1 } ], "incoming": 0, "item": { "id": "gid://shopify/InventoryItem/43729076", "sku": "draft-151" }, "location": { "id": "gid://shopify/Location/124656943", "name": "Shipping Origin" } } } } ```