Behaviour of inventoryQuantities in productSet mutation

Using productSet mutation to create a new product - it seems like setting inventoryQuantities in any of the variants does not add inventory to the created variant.

This can be replicated using the “winter hat” example in the productSet documentation page but adding inventoryQuantities to the variants.

When I ask the AI Dev Assistant, it told me not to trust this input as it’s most likely ignored during product creation (lol). Can we get some clarification on this, please?

Edit: API version 2025-10, tested both sync and async flavour of the productSet mutation.

mutation createProductAsynchronous($productSet: ProductSetInput!, $synchronous: Boolean!) {
  productSet(synchronous: $synchronous, input: $productSet) {
    product {
      id
    }
    productSetOperation {
      id
      status
      userErrors {
        code
        field
        message
      }
    }
    userErrors {
      code
      field
      message
    }
  }
}
{
  "synchronous": false,
  "productSet": {
    "title": "winter hat",
    "productOptions": [
      {
        "name": "Color",
        "position": 1,
        "values": [
          {
            "name": "Grey"
          },
          {
            "name": "Black"
          }
        ]
      }
    ],
    "variants": [
      {
        "optionValues": [
          {
            "optionName": "Color",
            "name": "Grey"
          }
        ],
        "price": 79.99,
        "inventoryQuantities": {
          "locationId": "gid://shopify/Location/123456789",
          "name": "available",
          "quantity": 12
        }
      },
      {
        "optionValues": [
          {
            "optionName": "Color",
            "name": "Black"
          }
        ],
        "price": 69.99,
        "inventoryQuantities": {
          "locationId": "gid://shopify/Location/123456789",
          "name": "available",
          "quantity": 10
        }
      }
    ]
  }
}
1 Like

Hi @GGGGY,

I can confirm that the AI Assistant is incorrect in this case, as the inventoryQuantity is not ignored during product creation and is actually working as expected.

I’ve been able to replicate the behaviour you’re reporting on my own test store, and the quantity is actually being set in the back end, its just not visible right away since you haven’t specified that the InventoryItem allows inventory tracking.

For example, using the same query inputs that you shared above on my own test store, it created the product variants and doesn’t show any inventory quantities.

If you view the variants themselves in the admin, it shows that the inventory tracking is disabled.

If you enable it via the switch there, it will show the full quantities that you specified in the original productSet mutation.

You can work around this with the productSet mutation, by ensuring that you pass the inventoryItem.tracked = true input argument, like so:

{
  "synchronous": false,
  "productSet": {
    "title": "Winter Hat - Inventory Quantity Test 2",
    "productOptions": [
      {
        "name": "Color",
        "position": 1,
        "values": [
          {
            "name": "Grey"
          },
          {
            "name": "Black"
          }
        ]
      }
    ],
    "variants": [
      {
        "optionValues": [
          {
            "optionName": "Color",
            "name": "Grey"
          }
        ],
        "price": 79.99,
        "inventoryQuantities": {
          "locationId": "gid://shopify/Location/69128683682",
          "name": "available",
          "quantity": 12
        },
        "inventoryItem": {
            "tracked": true
        }
      },
      {
        "optionValues": [
          {
            "optionName": "Color",
            "name": "Black"
          }
        ],
        "price": 69.99,
        "inventoryItem": {
            "tracked": true
        },
        "inventoryQuantities": {
          "locationId": "gid://shopify/Location/69128683682",
          "name": "available",
          "quantity": 10
        }
      }
    ]
  }
}