inventoryActivate
Requires access scope. Also: The user must have a permission to activate an inventory item.
Activate an inventory item at a location.
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.
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.
- 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
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-01/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)