inventory Move Quantitiesmutation
mutation
2024-10latest
Requires write
access scope. Also: The user must have a permission to move an inventory.
Moves inventory between inventory quantity names at a single location.
Arguments
The information required to move inventory quantities.
Was this section helpful?
InventoryMoveQuantitiesPayload returns
Anchor to InventoryMoveQuantitiesPayload.inventoryAdjustmentGroupinventoryAdjustment Group The group of changes made by the operation.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: inventoryMoveQuantities
Query Reference for MUTATION: inventoryMoveQuantities
"mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!) {\n inventoryMoveQuantities(input: $input) {\n inventoryAdjustmentGroup {\n # InventoryAdjustmentGroup fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: inventoryMoveQuantities
"{\n \"input\": {\n \"changes\": [\n {\n \"from\": {\n \"ledgerDocumentUri\": \"<your-ledgerDocumentUri>\",\n \"locationId\": \"gid://shopify/<objectName>/10079785100\",\n \"name\": \"<your-name>\"\n },\n \"inventoryItemId\": \"gid://shopify/<objectName>/10079785100\",\n \"quantity\": 1,\n \"to\": {\n \"ledgerDocumentUri\": \"<your-ledgerDocumentUri>\",\n \"locationId\": \"gid://shopify/<objectName>/10079785100\",\n \"name\": \"<your-name>\"\n }\n }\n ],\n \"reason\": \"<your-reason>\",\n \"referenceDocumentUri\": \"<your-referenceDocumentUri>\"\n }\n}"
Schema Reference for MUTATION: inventoryMoveQuantities
"input InventoryMoveQuantitiesInput {\n changes: [InventoryMoveQuantityChange!]!\n reason: String!\n referenceDocumentUri: String!\n}\n\ninput InventoryMoveQuantityChange {\n from: InventoryMoveQuantityTerminalInput!\n inventoryItemId: ID!\n quantity: Int!\n to: InventoryMoveQuantityTerminalInput!\n}\n"
Display Examples for MUTATION: inventoryMoveQuantities
[ { "example": { "type_name": "inventorymovequantities", "title": "Move 10 items from available to reserved, with reason damaged.", "query_string": "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}", "variables": { "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 } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/inventory/test/unit/graph_api/admin/mutations/inventory_move_quantities_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 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", "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", "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", "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", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<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\n$variables = [\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\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The information required to move inventory quantities.", "type": { "kind": "INPUT_OBJECT", "name": "InventoryMoveQuantitiesInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "InventoryMoveQuantitiesInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"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\"}}]}", "typeKind": "MUTATION" } ] } ]