--- title: Improved compare and swap inventory updates for the inventorySetQuantities mutation - Shopify developer changelog description: Shopify’s developer changelog documents all changes to Shopify’s platform. Find the latest news and learn about new platform opportunities. source_url: html: https://shopify.dev/changelog/compare-and-swap-redesign-for-inventory-set-quantities md: https://shopify.dev/changelog/compare-and-swap-redesign-for-inventory-set-quantities.md --- [Back to Developer changelog](https://shopify.dev/changelog) December 12, 2025 Tags: * Admin GraphQL API * 2026-01 # Improved compare and swap inventory updates for the `inventorySetQuantities` mutation This changelog relates to [concurrency protection features](https://shopify.dev/changelog/concurrency-protection-features). We've enhanced the compare-and-swap functionality in the [`inventorySetQuantities` mutation](https://shopify.dev/docs/api/admin-graphql/2026-01/mutations/inventorysetquantities) to make concurrent inventory updates more intuitive. You can now use the new `changeFromQuantity` field in [InventoryQuantityInput](https://shopify.dev/docs/api/admin-graphql/2026-01/input-objects/InventoryQuantityInput) to explicitly choose whether to perform quantity comparison checks. The use of [`compareQuantity`](https://shopify.dev/docs/api/admin-graphql/2026-01/input-objects/InventoryQuantityInput#fields-compareQuantity) and [`ignoreCompareQuantity`](https://shopify.dev/docs/api/admin-graphql/2026-01/input-objects/InventorySetQuantitiesInput#fields-ignoreCompareQuantity) will be deprecated . This `2026-01` change isn't considered breaking because if users don't pass in a value for `changeFromQuantity`, the mutation will fallback to using the values for `compareQuantity` and `ignoreCompareQuantity`. ### How to use the field Previously, to bypass comparison checks, you set `ignoreCompareQuantity` to `true`. Now, to bypass comparison checks, you explicitly pass `null` to the `changeFromQuantity` field. To enable checks, pass an integer that represents the initial quantity before it is updated to the [desired value](https://shopify.dev/docs/api/admin-graphql/2026-01/input-objects/InventoryQuantityInput#fields-quantity). Passing any value (including `null`) to `changeFromQuantity` will override any values passed to the `compareQuantity` and `ignoreCompareQuantity` fields. 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 } } } ``` ### Deprecating legacy fields The `compareQuantity` and `ignoreCompareQuantity` fields will be deprecated in version `2026-01`. We plan to remove them entirely starting from version `2026-04`. For more information on compare and swap, and when you should opt out of comparison checks, refer to [our docs](https://shopify.dev/docs/apps/build/orders-fulfillment/inventory-management-apps/manage-quantities-states#compare-and-swap). We encourage users to avoid opting-out unless it's justified by their use-case.