Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"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 } } } }\",\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\",\n \"available\": 42\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }`,\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\",\n \"available\": 42\n },\n },\n});\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 ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\",\n \"available\": 42\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryItemId\" => \"gid://shopify/InventoryItem/43729076\",\n \"locationId\" => \"gid://shopify/Location/346779380\",\n \"available\" => 42,\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }`,\n {\n variables: {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\",\n \"available\": 42\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n}"
input: { "inventoryItemId": "gid://shopify/InventoryItem/43729076", "locationId": "gid://shopify/Location/346779380", "available": 42 }
response: { "data": { "inventoryActivate": { "inventoryLevel": { "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=43729076", "quantities": [ { "name": "available", "quantity": 42 } ], "item": { "id": "gid://shopify/InventoryItem/43729076" }, "location": { "id": "gid://shopify/Location/346779380" } } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!) { inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) { inventoryLevel { id quantities(names: [\\\"available\\\"]) { name quantity } item { id } location { id } } } }\",\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }`,\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n },\n },\n});\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 ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryItemId\" => \"gid://shopify/InventoryItem/43729076\",\n \"locationId\" => \"gid://shopify/Location/346779380\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n }`,\n {\n variables: {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n item {\n id\n }\n location {\n id\n }\n }\n }\n}"
input: { "inventoryItemId": "gid://shopify/InventoryItem/43729076", "locationId": "gid://shopify/Location/346779380" }
response: { "data": { "inventoryActivate": { "inventoryLevel": { "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=43729076", "quantities": [ { "name": "available", "quantity": 0 } ], "item": { "id": "gid://shopify/InventoryItem/43729076" }, "location": { "id": "gid://shopify/Location/346779380" } } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation InventoryActivate($inventoryItemId: ID!, $locationId: ID!) { inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) { inventoryLevel { id canDeactivate createdAt item { id } location { id } quantities(names: [\\\"available\\\"]) { name quantity } updatedAt } } }\",\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation InventoryActivate($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n canDeactivate\n createdAt\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n updatedAt\n }\n }\n }`,\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n },\n },\n});\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 InventoryActivate($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n canDeactivate\n createdAt\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n updatedAt\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation InventoryActivate($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n canDeactivate\n createdAt\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n updatedAt\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryItemId\" => \"gid://shopify/InventoryItem/43729076\",\n \"locationId\" => \"gid://shopify/Location/346779380\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation InventoryActivate($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n canDeactivate\n createdAt\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n updatedAt\n }\n }\n }`,\n {\n variables: {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/43729076\",\n \"locationId\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation InventoryActivate($inventoryItemId: ID!, $locationId: ID!) {\n inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId) {\n inventoryLevel {\n id\n canDeactivate\n createdAt\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n updatedAt\n }\n }\n}"
input: { "inventoryItemId": "gid://shopify/InventoryItem/43729076", "locationId": "gid://shopify/Location/346779380" }
response: { "data": { "inventoryActivate": { "inventoryLevel": { "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=43729076", "canDeactivate": true, "createdAt": "2024-11-07T20:59:45Z", "item": { "id": "gid://shopify/InventoryItem/43729076" }, "location": { "id": "gid://shopify/Location/346779380" }, "quantities": [ { "name": "available", "quantity": 0 } ], "updatedAt": "2024-11-07T20:59:45Z" } } } }