mutation inventorySetQuantities($input: InventorySetQuantitiesInput!) {
inventorySetQuantities(input: $input) {
inventoryAdjustmentGroup {
reason
referenceDocumentUri
changes {
name
delta
quantityAfterChange
}
}
userErrors {
code
field
message
}
}
}
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 inventorySetQuantities($input: InventorySetQuantitiesInput!) { inventorySetQuantities(input: $input) { inventoryAdjustmentGroup { reason referenceDocumentUri changes { name delta quantityAfterChange } } userErrors { code field message } } }",
"variables": {
"input": {
"name": "available",
"reason": "correction",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"quantities": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"locationId": "gid://shopify/Location/124656943",
"quantity": 11,
"compareQuantity": 1
}
]
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation inventorySetQuantities($input: InventorySetQuantitiesInput!) {
inventorySetQuantities(input: $input) {
inventoryAdjustmentGroup {
reason
referenceDocumentUri
changes {
name
delta
quantityAfterChange
}
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"input": {
"name": "available",
"reason": "correction",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"quantities": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"locationId": "gid://shopify/Location/124656943",
"quantity": 11,
"compareQuantity": 1
}
]
}
},
},
);
const data = await response.json();
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 inventorySetQuantities($input: InventorySetQuantitiesInput!) {
inventorySetQuantities(input: $input) {
inventoryAdjustmentGroup {
reason
referenceDocumentUri
changes {
name
delta
quantityAfterChange
}
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"input": {
"name": "available",
"reason": "correction",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"quantities": [{"inventoryItemId"=>"gid://shopify/InventoryItem/30322695", "locationId"=>"gid://shopify/Location/124656943", "quantity"=>11, "compareQuantity"=>1}]
}
}
response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation inventorySetQuantities($input: InventorySetQuantitiesInput!) {
inventorySetQuantities(input: $input) {
inventoryAdjustmentGroup {
reason
referenceDocumentUri
changes {
name
delta
quantityAfterChange
}
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"input": {
"name": "available",
"reason": "correction",
"referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"quantities": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"locationId": "gid://shopify/Location/124656943",
"quantity": 11,
"compareQuantity": 1
}
]
}
},
},
});
use Shopify\Clients\Graphql;
$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
mutation inventorySetQuantities($input: InventorySetQuantitiesInput!) {
inventorySetQuantities(input: $input) {
inventoryAdjustmentGroup {
reason
referenceDocumentUri
changes {
name
delta
quantityAfterChange
}
}
userErrors {
code
field
message
}
}
}
QUERY;
$variables = [
"input" => [
"name" => "available",
"reason" => "correction",
"referenceDocumentUri" => "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
"quantities" => [{"inventoryItemId"=>"gid://shopify/InventoryItem/30322695", "locationId"=>"gid://shopify/Location/124656943", "quantity"=>11, "compareQuantity"=>1}],
],
];
$response = $client->query(["query" => $query, "variables" => $variables]);