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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) { inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) { inventoryItem { id } inventoryLevels { id quantities(names: [\\\"available\\\"]) { name quantity } location { id } } userErrors { field message code } } }\",\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/648019273\",\n \"activate\": true\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/648019273\",\n \"activate\": true\n }\n ]\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [{\"locationId\"=>\"gid://shopify/Location/648019273\", \"activate\"=>true}]\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryItemId\" => \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\" => [{\"locationId\"=>\"gid://shopify/Location/648019273\", \"activate\"=>true}],\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/648019273\",\n \"activate\": true\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "inventoryItemId": "gid://shopify/InventoryItem/30322695", "inventoryItemUpdates": [ { "locationId": "gid://shopify/Location/648019273", "activate": true } ] }
response: { "data": { "inventoryBulkToggleActivation": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695" }, "inventoryLevels": [ { "id": "gid://shopify/InventoryLevel/30691503?inventory_item_id=30322695", "quantities": [ { "name": "available", "quantity": 0 } ], "location": { "id": "gid://shopify/Location/648019273" } } ], "userErrors": [] } } }
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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) { inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) { inventoryItem { id } inventoryLevels { id } userErrors { field message code } } }\",\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"activate\": false\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"activate\": false\n }\n ]\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [{\"locationId\"=>\"gid://shopify/Location/124656943\", \"activate\"=>false}]\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryItemId\" => \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\" => [{\"locationId\"=>\"gid://shopify/Location/124656943\", \"activate\"=>false}],\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"activate\": false\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "inventoryItemId": "gid://shopify/InventoryItem/30322695", "inventoryItemUpdates": [ { "locationId": "gid://shopify/Location/124656943", "activate": false } ] }
response: { "data": { "inventoryBulkToggleActivation": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695" }, "inventoryLevels": [], "userErrors": [] } } }
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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) { inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) { inventoryItem { id } inventoryLevels { id quantities(names: [\\\"available\\\"]) { name quantity } location { id } } userErrors { field message code } } }\",\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"activate\": false\n },\n {\n \"locationId\": \"gid://shopify/Location/648019273\",\n \"activate\": true\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"activate\": false\n },\n {\n \"locationId\": \"gid://shopify/Location/648019273\",\n \"activate\": true\n }\n ]\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [{\"locationId\"=>\"gid://shopify/Location/124656943\", \"activate\"=>false}, {\"locationId\"=>\"gid://shopify/Location/648019273\", \"activate\"=>true}]\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"inventoryItemId\" => \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\" => [{\"locationId\"=>\"gid://shopify/Location/124656943\", \"activate\"=>false}, {\"locationId\"=>\"gid://shopify/Location/648019273\", \"activate\"=>true}],\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 inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"inventoryItemUpdates\": [\n {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"activate\": false\n },\n {\n \"locationId\": \"gid://shopify/Location/648019273\",\n \"activate\": true\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation inventoryBulkToggleActivation($inventoryItemId: ID!, $inventoryItemUpdates: [InventoryBulkToggleActivationInput!]!) {\n inventoryBulkToggleActivation(inventoryItemId: $inventoryItemId, inventoryItemUpdates: $inventoryItemUpdates) {\n inventoryItem {\n id\n }\n inventoryLevels {\n id\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n location {\n id\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "inventoryItemId": "gid://shopify/InventoryItem/30322695", "inventoryItemUpdates": [ { "locationId": "gid://shopify/Location/124656943", "activate": false }, { "locationId": "gid://shopify/Location/648019273", "activate": true } ] }
response: { "data": { "inventoryBulkToggleActivation": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695" }, "inventoryLevels": [ { "id": "gid://shopify/InventoryLevel/30691503?inventory_item_id=30322695", "quantities": [ { "name": "available", "quantity": 0 } ], "location": { "id": "gid://shopify/Location/648019273" } } ], "userErrors": [] } } }