Tags:
- Action Required
- Admin GraphQL API
- 2026-04
New compare and swap syntax for the inventorySetQuantities mutation
inventorySetQuantities mutationThis changelog is relates to concurrency protection features.
We're making the field introduced in 2026-01 mandatory and removing the and fields for the mutation.
This is a breaking change. Note that even though the field doesn't show up as mandatory at the schema level, calling these mutations without passing in null or passing in the current actual quantity will result in an error at runtime.
What you need to do
Before migrating to version 2026-04, update your application logic to include the argument:
- To enable concurrency checks (Recommended): Pass the expected current quantity.
- To opt-out (skip checks): Explicitly pass
Additionally, before migrating, you must remove the argument and the argument from your mutation calls.
How to use the field
Previously, to bypass comparison checks, you set to true.
Now, to bypass comparison checks, you explicitly pass null to the field. To enable checks, pass an integer that represents the initial quantity before it is updated to the desired value.
In the following example, the operation will only successfully set the new available quantity to 12 if the current available quantity is 5. If another process has modified the quantity in the meantime, you'll receive an error and can retry with the updated value.
mutation {
inventorySetQuantities(
input: {
quantities: [
{
quantity: 12,
inventoryItemId: "gid://shopify/InventoryItem/2",
locationId: "gid://shopify/Location/1",
changeFromQuantity: 5
}
],
reason: "correction",
name: "available"
}
) {
inventoryAdjustmentGroup {
id
}
userErrors {
code
message
}
}
}
Removing legacy fields
The and fields will be removed in version 2026-04.
For more information on compare and swap, and when you should opt out of comparison checks, refer to our docs. We encourage users to avoid opting-out unless it's justified by their use-case.