inventory Deactivatemutation
mutation
2024-10latest
Requires write
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.
Arguments
The ID of the inventory level to deactivate.
Was this section helpful?
InventoryDeactivatePayload returns
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: inventoryDeactivate
Query Reference for MUTATION: inventoryDeactivate
"mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: inventoryDeactivate
"{\n \"inventoryLevelId\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: inventoryDeactivate
""
Display Examples for MUTATION: inventoryDeactivate
[ { "example": { "type_name": "inventorydeactivate", "title": "Deactivate an inventory item at a location", "query_string": "mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n}", "variables": { "inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926" }, "response": { "data": { "inventoryDeactivate": { "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/inventory/test/unit/graph_api/admin/mutations/inventory_deactivate_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation inventoryDeactivate($inventoryLevelId: ID!) { inventoryDeactivate(inventoryLevelId: $inventoryLevelId) { userErrors { message } } }\",\n \"variables\": {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }`,\n {\n variables: {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }`,\n \"variables\": {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryLevelId\" => \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "inventoryLevelId", "description": "The ID of the inventory level to deactivate.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "inventoryLevelId", "argValue": " \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"", "typeKind": "MUTATION" } ] } ]