Version: 2024-10
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 inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) { inventoryMoveQuantities(input: $input) { userErrors { field message code } inventoryAdjustmentGroup { createdAt reason referenceDocumentUri changes(quantityNames: $quantityNames) { name delta } } } }\",\n \"variables\": {\n \"input\": {\n \"reason\": \"damaged\",\n \"referenceDocumentUri\": \"logistics://some.warehouse/take/2023-01-23T13:14:15Z\",\n \"changes\": [\n {\n \"quantity\": 10,\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"from\": {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"name\": \"available\",\n \"ledgerDocumentUri\": null\n },\n \"to\": {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"name\": \"reserved\",\n \"ledgerDocumentUri\": \"logistics://toronto.warehouse/work-orders/2023-01-04/2\"\n }\n }\n ]\n },\n \"quantityNames\": [\n \"committed\",\n \"reserved\",\n \"safety_stock\",\n \"quality_control\",\n \"damaged\",\n \"available\",\n \"on_hand\",\n \"incoming\"\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {\n inventoryMoveQuantities(input: $input) {\n userErrors {\n field\n message\n code\n }\n inventoryAdjustmentGroup {\n createdAt\n reason\n referenceDocumentUri\n changes(quantityNames: $quantityNames) {\n name\n delta\n }\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"reason\": \"damaged\",\n \"referenceDocumentUri\": \"logistics://some.warehouse/take/2023-01-23T13:14:15Z\",\n \"changes\": [\n {\n \"quantity\": 10,\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"from\": {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"name\": \"available\",\n \"ledgerDocumentUri\": null\n },\n \"to\": {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"name\": \"reserved\",\n \"ledgerDocumentUri\": \"logistics://toronto.warehouse/work-orders/2023-01-04/2\"\n }\n }\n ]\n },\n \"quantityNames\": [\n \"committed\",\n \"reserved\",\n \"safety_stock\",\n \"quality_control\",\n \"damaged\",\n \"available\",\n \"on_hand\",\n \"incoming\"\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 inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {\n inventoryMoveQuantities(input: $input) {\n userErrors {\n field\n message\n code\n }\n inventoryAdjustmentGroup {\n createdAt\n reason\n referenceDocumentUri\n changes(quantityNames: $quantityNames) {\n name\n delta\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"reason\": \"damaged\",\n \"referenceDocumentUri\": \"logistics://some.warehouse/take/2023-01-23T13:14:15Z\",\n \"changes\": [{\"quantity\"=>10, \"inventoryItemId\"=>\"gid://shopify/InventoryItem/30322695\", \"from\"=>{\"locationId\"=>\"gid://shopify/Location/124656943\", \"name\"=>\"available\", \"ledgerDocumentUri\"=>nil}, \"to\"=>{\"locationId\"=>\"gid://shopify/Location/124656943\", \"name\"=>\"reserved\", \"ledgerDocumentUri\"=>\"logistics://toronto.warehouse/work-orders/2023-01-04/2\"}}]\n },\n \"quantityNames\": [\"committed\", \"reserved\", \"safety_stock\", \"quality_control\", \"damaged\", \"available\", \"on_hand\", \"incoming\"]\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 = <<[\n \"reason\" => \"damaged\",\n \"referenceDocumentUri\" => \"logistics://some.warehouse/take/2023-01-23T13:14:15Z\",\n \"changes\" => [{\"quantity\"=>10, \"inventoryItemId\"=>\"gid://shopify/InventoryItem/30322695\", \"from\"=>{\"locationId\"=>\"gid://shopify/Location/124656943\", \"name\"=>\"available\", \"ledgerDocumentUri\"=>nil}, \"to\"=>{\"locationId\"=>\"gid://shopify/Location/124656943\", \"name\"=>\"reserved\", \"ledgerDocumentUri\"=>\"logistics://toronto.warehouse/work-orders/2023-01-04/2\"}}],\n ],\n \"quantityNames\" => [\"committed\", \"reserved\", \"safety_stock\", \"quality_control\", \"damaged\", \"available\", \"on_hand\", \"incoming\"],\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 inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {\n inventoryMoveQuantities(input: $input) {\n userErrors {\n field\n message\n code\n }\n inventoryAdjustmentGroup {\n createdAt\n reason\n referenceDocumentUri\n changes(quantityNames: $quantityNames) {\n name\n delta\n }\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"reason\": \"damaged\",\n \"referenceDocumentUri\": \"logistics://some.warehouse/take/2023-01-23T13:14:15Z\",\n \"changes\": [\n {\n \"quantity\": 10,\n \"inventoryItemId\": \"gid://shopify/InventoryItem/30322695\",\n \"from\": {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"name\": \"available\",\n \"ledgerDocumentUri\": null\n },\n \"to\": {\n \"locationId\": \"gid://shopify/Location/124656943\",\n \"name\": \"reserved\",\n \"ledgerDocumentUri\": \"logistics://toronto.warehouse/work-orders/2023-01-04/2\"\n }\n }\n ]\n },\n \"quantityNames\": [\n \"committed\",\n \"reserved\",\n \"safety_stock\",\n \"quality_control\",\n \"damaged\",\n \"available\",\n \"on_hand\",\n \"incoming\"\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {\n inventoryMoveQuantities(input: $input) {\n userErrors {\n field\n message\n code\n }\n inventoryAdjustmentGroup {\n createdAt\n reason\n referenceDocumentUri\n changes(quantityNames: $quantityNames) {\n name\n delta\n }\n }\n }\n}"
input: { "input": { "reason": "damaged", "referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z", "changes": [ { "quantity": 10, "inventoryItemId": "gid://shopify/InventoryItem/30322695", "from": { "locationId": "gid://shopify/Location/124656943", "name": "available", "ledgerDocumentUri": null }, "to": { "locationId": "gid://shopify/Location/124656943", "name": "reserved", "ledgerDocumentUri": "logistics://toronto.warehouse/work-orders/2023-01-04/2" } } ] }, "quantityNames": [ "committed", "reserved", "safety_stock", "quality_control", "damaged", "available", "on_hand", "incoming" ] }
response: { "data": { "inventoryMoveQuantities": { "userErrors": [], "inventoryAdjustmentGroup": { "createdAt": "2024-09-12T01:06:28Z", "reason": "Damaged", "referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z", "changes": [ { "name": "available", "delta": -10 }, { "name": "reserved", "delta": 10 } ] } } } }