Anchor to inventoryBulkAdjustQuantityAtLocationinventory
inventoryBulkAdjustQuantityAtLocation
mutationDeprecated
Requires access scope. Also: The user must have a permission to adjust an inventory quantity.
Adjusts the inventory at a location for multiple inventory items. Use instead.
Anchor to Arguments
Arguments
- Anchor to inventoryItemAdjustmentsinventory•
Item Adjustments [InventoryAdjust requiredItem Input!]! Specifies adjustments for items.
- Anchor to locationIdlocation•
Id ID!required Specifies where the item should be adjusted.
Was this section helpful?
Anchor to InventoryBulkAdjustQuantityAtLocationPayload returnsInventoryBulkAdjustQuantityAtLocationPayload returns
- Anchor to inventoryLevelsinventory•
Levels Represents the updated inventory quantities of an inventory item at the location.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Decrease the available inventory of a single item at a location by 10
- Increase the available inventory of a single item at a location by 3
- Increase the available inventory of multiple items at a location
- inventoryBulkAdjustQuantityAtLocation reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation InventoryBulkAdjustQuantitiesAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: "gid://shopify/Location/124656943") {
inventoryLevels {
id
quantities(names: ["available"]) {
name
quantity
}
incoming
item {
id
sku
}
location {
id
name
}
}
}
}`,
{
variables: {
mutation InventoryBulkAdjustQuantitiesAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: "gid://shopify/Location/124656943") {
inventoryLevels {
id
quantities(names: ["available"]) {
name
quantity
}
incoming
item {
id
sku
}
location {
id
name
}
}
}
}
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 InventoryBulkAdjustQuantitiesAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!) { inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: \"gid://shopify/Location/124656943\") { inventoryLevels { id quantities(names: [\"available\"]) { name quantity } incoming item { id sku } location { id name } } } }",
"variables": {
"inventoryItemAdjustments": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"availableDelta": -10
}
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation InventoryBulkAdjustQuantitiesAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: "gid://shopify/Location/124656943") {
inventoryLevels {
id
quantities(names: ["available"]) {
name
quantity
}
incoming
item {
id
sku
}
location {
id
name
}
}
}
}`,
{
variables: {
"inventoryItemAdjustments": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"availableDelta": -10
}
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation InventoryBulkAdjustQuantitiesAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: "gid://shopify/Location/124656943") {
inventoryLevels {
id
quantities(names: ["available"]) {
name
quantity
}
incoming
item {
id
sku
}
location {
id
name
}
}
}
}`,
"variables": {
"inventoryItemAdjustments": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"availableDelta": -10
}
]
},
},
});
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 InventoryBulkAdjustQuantitiesAtLocation($inventoryItemAdjustments: [InventoryAdjustItemInput!]!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $inventoryItemAdjustments, locationId: "gid://shopify/Location/124656943") {
inventoryLevels {
id
quantities(names: ["available"]) {
name
quantity
}
incoming
item {
id
sku
}
location {
id
name
}
}
}
}
QUERY
variables = {
"inventoryItemAdjustments": [{"inventoryItemId"=>"gid://shopify/InventoryItem/30322695", "availableDelta"=>-10}]
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"inventoryItemAdjustments": [
{
"inventoryItemId": "gid://shopify/InventoryItem/30322695",
"availableDelta": -10
}
]
}
Response
JSON{
"inventoryBulkAdjustQuantityAtLocation": {
"inventoryLevels": [
{
"id": "gid://shopify/InventoryLevel/964427794?inventory_item_id=30322695",
"quantities": [
{
"name": "available",
"quantity": -9
}
],
"incoming": 0,
"item": {
"id": "gid://shopify/InventoryItem/30322695",
"sku": "element-151"
},
"location": {
"id": "gid://shopify/Location/124656943",
"name": "Shipping Origin"
}
}
]
}
}