Anchor to inventoryActivateinventory
inventoryActivate
mutation
Requires access scope. Also: The user must have a permission to activate an inventory item.
Activate an inventory item at a location.
Anchor to Arguments
Arguments
- Anchor to availableavailable•
The initial available quantity of the inventory item being activated at the location.
- Anchor to inventoryItemIdinventory•
Item Id ID!required The ID of the inventory item to activate.
- Anchor to locationIdlocation•
Id ID!required The ID of the location of the inventory item being activated.
- Anchor to onHandon•
Hand The initial on_hand quantity of the inventory item being activated at the location.
- Anchor to stockAtLegacyLocationstock•
At Legacy Location BooleanDefault:false Allow activation at or away from fulfillment service location with sku sharing off. This will deactivate inventory at all other locations.
Was this section helpful?
Anchor to InventoryActivatePayload returnsInventoryActivatePayload returns
- Anchor to inventoryLevelinventory•
Level The inventory level that was activated.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Activate an inventory item at a location with an initial available quantity
- Activate an inventory item at a location without setting an available quantity
- Connects an inventory item to a location
- inventoryActivate reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {6 inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {7 inventoryLevel {8 id9 quantities(names: ["available"]) {10 name11 quantity12 }13 item {14 id15 }16 location {17 id18 }19 }20 }21 }`,22 {23 variables: {24 "inventoryItemId": "gid://shopify/InventoryItem/43729076",25 "locationId": "gid://shopify/Location/346779380",26 "available": 4227 },28 },29);3031const data = await response.json();32
mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {
inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {
inventoryLevel {
id
quantities(names: ["available"]) {
name
quantity
}
item {
id
}
location {
id
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) { inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) { inventoryLevel { id quantities(names: [\"available\"]) { name quantity } item { id } location { id } } } }",
"variables": {
"inventoryItemId": "gid://shopify/InventoryItem/43729076",
"locationId": "gid://shopify/Location/346779380",
"available": 42
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {
inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {
inventoryLevel {
id
quantities(names: ["available"]) {
name
quantity
}
item {
id
}
location {
id
}
}
}
}`,
{
variables: {
"inventoryItemId": "gid://shopify/InventoryItem/43729076",
"locationId": "gid://shopify/Location/346779380",
"available": 42
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {
inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {
inventoryLevel {
id
quantities(names: ["available"]) {
name
quantity
}
item {
id
}
location {
id
}
}
}
}`,
"variables": {
"inventoryItemId": "gid://shopify/InventoryItem/43729076",
"locationId": "gid://shopify/Location/346779380",
"available": 42
},
},
});
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 ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {
inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {
inventoryLevel {
id
quantities(names: ["available"]) {
name
quantity
}
item {
id
}
location {
id
}
}
}
}
QUERY
variables = {
"inventoryItemId": "gid://shopify/InventoryItem/43729076",
"locationId": "gid://shopify/Location/346779380",
"available": 42
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "inventoryItemId": "gid://shopify/InventoryItem/43729076",3 "locationId": "gid://shopify/Location/346779380",4 "available": 425}
Response
JSON1{2 "inventoryActivate": {3 "inventoryLevel": {4 "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=43729076",5 "quantities": [6 {7 "name": "available",8 "quantity": 429 }10 ],11 "item": {12 "id": "gid://shopify/InventoryItem/43729076"13 },14 "location": {15 "id": "gid://shopify/Location/346779380"16 }17 }18 }19}