Anchor to inventoryDeactivateinventory
inventoryDeactivate
mutation
Requires access scope. Also: The user must have a permission to deactivate an inventory.
Removes an inventory item's quantities from a location, and turns off inventory at the location.
Anchor to Arguments
Arguments
- Anchor to inventoryLevelIdinventory•
Level Id ID!required The ID of the inventory level to deactivate.
Was this section helpful?
Anchor to InventoryDeactivatePayload returnsInventoryDeactivatePayload returns
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Deletes an inventory level from a location
- inventoryDeactivate reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation inventoryDeactivate($inventoryLevelId: ID!) {
inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {
userErrors {
message
}
}
}`,
{
variables: {
"inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926"
},
},
);
const data = await response.json();
mutation inventoryDeactivate($inventoryLevelId: ID!) {
inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {
userErrors {
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation inventoryDeactivate($inventoryLevelId: ID!) { inventoryDeactivate(inventoryLevelId: $inventoryLevelId) { userErrors { message } } }",
"variables": {
"inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation inventoryDeactivate($inventoryLevelId: ID!) {
inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {
userErrors {
message
}
}
}`,
{
variables: {
"inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation inventoryDeactivate($inventoryLevelId: ID!) {
inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {
userErrors {
message
}
}
}`,
"variables": {
"inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926"
},
},
});
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 inventoryDeactivate($inventoryLevelId: ID!) {
inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {
userErrors {
message
}
}
}
QUERY
variables = {
"inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926"
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926"
}
Response
JSON{
"inventoryDeactivate": {
"userErrors": []
}
}