---
title: >-
  New compare and swap syntax 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/posts/finalizing-compare-and-swap-redesign-for-inventory-set-quantities
  md: >-
    https://shopify.dev/changelog/posts/finalizing-compare-and-swap-redesign-for-inventory-set-quantities.md
metadata:
  effectiveApiVersion: 2026-04
  affectedApi:
    - displayName: Admin GraphQL API
      handle: admin-graphql
  primaryTag:
    displayName: API
    handle: api
  secondaryTag:
    displayName: Breaking API Change
    handle: breaking-api-change
  indicatesActionRequired: true
  createdAt: '2025-12-05T19:29:31-05:00'
  postedAt: '2025-12-12T12:00:00-05:00'
  updatedAt: '2025-12-10T08:30:54-05:00'
  effectiveAt: '2025-12-12T12:00:00-05:00'
---

December 12, 2025

# New compare and swap syntax for the `inventorySetQuantities` mutation

DateDecember 12, 2025

Version[2026-04](https://shopify.dev/changelog?api_version=2026-04)

Flags[Breaking API Change](https://shopify.dev/changelog?filter=breaking-api-change)[Action required](https://shopify.dev/changelog?action_required=true)

SurfacesAPI

Affected APIs[Admin GraphQL API](https://shopify.dev/changelog?api_type=admin-graphql)

This changelog is relates to [concurrency protection features](https://shopify.dev/changelog/concurrency-protection-features).

We're making the `changeFromQuantity` field introduced [in `2026-01`](https://shopify.dev/changelog/compare-and-swap-redesign-for-inventory-set-quantities) mandatory and removing the [`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) fields for the [`inventorySetQuantities`](https://shopify.dev/docs/api/admin-graphql/2026-04/mutations/inventorysetquantities) mutation.

This is a breaking change. Note that even though the `changeFromQuantity` 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 `changeFromQuantity` argument:

* To enable concurrency checks (Recommended): Pass the expected current quantity.
* To opt-out (skip checks): Explicitly pass `changeFromQuantity: null`

Additionally, before migrating, you must remove the `ignoreCompareQuantity` argument and the `compareQuantity` argument from your mutation calls.

### 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).

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 `compareQuantity` and `ignoreCompareQuantity` 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](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.
