Anchor to section titled 'undefined'

inventoryAdjustQuantities
mutation

Requires write_inventory access scope. Also: The user must have a permission to apply changes to inventory quantities.

Apply changes to inventory quantities.


The information required to adjust inventory quantities.


Was this section helpful?

The group of changes made by the operation.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
Copy
mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) { inventoryAdjustQuantities(input: $input) { userErrors { field message } inventoryAdjustmentGroup { createdAt reason referenceDocumentUri changes { name delta } } } }",
"variables": {
"input": {
"reason": "correction",
"name": "available",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01/13",
"changes": [
{
"delta": -4,
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"locationId": "gid://shopify/Location/124656943"
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
`#graphql
mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}`,
{
variables: {
"input": {
"reason": "correction",
"name": "available",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01/13",
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 inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}
QUERY

variables = {
"input": {
"reason": "correction",
"name": "available",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01/13",
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}`,
"variables": {
"input": {
"reason": "correction",
"name": "available",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01/13",
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
mutation inventoryAdjustQuantities($input: InventoryAdjustQuantitiesInput!) {
inventoryAdjustQuantities(input: $input) {
userErrors {
field
message
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes {
name
delta
}
}
}
}
QUERY;

$variables = [
"input" => [
"reason" => "correction",
"name" => "available",
"referenceDocumentUri" => "logistics://some.warehouse/take/2023-01/13",
"changes" => [{"delta"=>-4, "inventoryItemId"=>"gid://shopify/InventoryItem/30322695", "locationId"=>"gid://shopify/Location/124656943"}],
Hide code
Input variables
Copy
{
"input": {
"reason": "correction",
"name": "available",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01/13",
"changes": []
}
}

Hide code
Response
JSON
{
"inventoryAdjustQuantities": {
"userErrors": [],
"inventoryAdjustmentGroup": {
"createdAt": "2024-11-07T21:47:12Z",
"reason": "Inventory correction",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01/13",
"changes": [
{
"name": "available",
"delta": -4
},
{
"name": "on_hand",
"delta": -4
}
]
}
}
}