Anchor to inventoryMoveQuantitiesinventory
inventoryMoveQuantities
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 requiredQuantities Input! The information required to move inventory quantities.
Was this section helpful?
Anchor to InventoryMoveQuantitiesPayload returnsInventoryMoveQuantitiesPayload returns
- 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?
- Move 10 items from available to reserved, with reason damaged.
- inventoryMoveQuantities reference
Examples
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",
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/2025-01/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
JSON{
"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",
Response
JSON{
"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
}
]
}
}
}