Anchor to inventoryMoveQuantitiesinventory
inventory Move Quantities
mutation
Requires access scope. Also: The user must have a permission to move an inventory.
Moves inventory between inventory quantity names at a single location.
Anchor to Arguments
Arguments
- Anchor to inputinput•Inventory
Move Quantities Input!required The information required to move inventory quantities.
Was this section helpful?
- Anchor to inventoryAdjustmentGroupinventory•
Adjustment Group The group of changes made by the operation.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
Was this section helpful?
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {6 inventoryMoveQuantities(input: $input) {7 userErrors {8 field9 message10 code11 }12 inventoryAdjustmentGroup {13 createdAt14 reason15 referenceDocumentUri16 changes(quantityNames: $quantityNames) {17 name18 delta19 }20 }21 }22 }`,23 {24 variables: {25 "input": {26 "reason": "damaged",27 "referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",28 "changes": [29 {30 "quantity": 10,31 "inventoryItemId": "gid://shopify/InventoryItem/30322695",32 "from": {33 "locationId": "gid://shopify/Location/124656943",34 "name": "available",35 "ledgerDocumentUri": null36 },37 "to": {38 "locationId": "gid://shopify/Location/124656943",39 "name": "reserved",40 "ledgerDocumentUri": "logistics://toronto.warehouse/work-orders/2023-01-04/2"41 }42 }43 ]44 },45 "quantityNames": [46 "committed",47 "reserved",48 "safety_stock",49 "quality_control",50 "damaged",51 "available",52 "on_hand",53 "incoming"54 ]55 },56 },57);5859const data = await response.json();60
mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) { inventoryMoveQuantities(input: $input) { userErrors { field message code } inventoryAdjustmentGroup { createdAt reason referenceDocumentUri changes(quantityNames: $quantityNames) { name delta } } } }",
"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"
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}`,
{
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"
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}`,
"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"
]
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation inventoryMoveQuantities($input: InventoryMoveQuantitiesInput!, $quantityNames: [String!]) {
inventoryMoveQuantities(input: $input) {
userErrors {
field
message
code
}
inventoryAdjustmentGroup {
createdAt
reason
referenceDocumentUri
changes(quantityNames: $quantityNames) {
name
delta
}
}
}
}
QUERY
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"=>nil}, "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 = client.query(query: query, variables: variables)
Input variables
JSON1{2 "input": {3 "reason": "damaged",4 "referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",5 "changes": [6 {7 "quantity": 10,8 "inventoryItemId": "gid://shopify/InventoryItem/30322695",9 "from": {10 "locationId": "gid://shopify/Location/124656943",11 "name": "available",12 "ledgerDocumentUri": null13 },14 "to": {15 "locationId": "gid://shopify/Location/124656943",16 "name": "reserved",17 "ledgerDocumentUri": "logistics://toronto.warehouse/work-orders/2023-01-04/2"18 }19 }20 ]21 },22 "quantityNames": [23 "committed",24 "reserved",25 "safety_stock",26 "quality_control",27 "damaged",28 "available",29 "on_hand",30 "incoming"31 ]32}
Response
JSON1{2 "inventoryMoveQuantities": {3 "userErrors": [],4 "inventoryAdjustmentGroup": {5 "createdAt": "2024-09-12T01:06:28Z",6 "reason": "Damaged",7 "referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",8 "changes": [9 {10 "name": "available",11 "delta": -1012 },13 {14 "name": "reserved",15 "delta": 1016 }17 ]18 }19 }20}