Mutation InventorySetQuantitiesInput is working or not ?

Hi there,

I’m following the new mutation rules to apply stock update

I tested successfully inventoryAdjustQuantities & inventorySetOnHandQuantities mutation.

query

query_template = '''
mutation inventorySetQuantities($input: InventorySetQuantitiesInput!) {
  inventorySetQuantities(input: $input) {
    inventoryAdjustmentGroup {
      reason
      referenceDocumentUri
      changes {
        name
        delta
        quantityAfterChange
      }
    }
    userErrors {
      code
      field
      message
    }
  }
}
'''

# Variables for the mutation
variables = {
  "input": {
    "name": "available",
    "reason": "correction",
    "referenceDocumentUri": "logistics://some.warehouse/take/2023-01-23T13:14:15Z",
    "quantities": [
      {
        "inventoryItemId": "gid://shopify/InventoryItem/49021181952338",
        "locationId": "gid://shopify/Location/63449858218",
        "quantity": 11,
        "compareQuantity": 1
      }
    ]
  }
}

But with the InventorySetQuantitiesInput I have this error

{‘errors’: [{‘message’: “InventorySetQuantitiesInput isn’t a defined input type (on $input)”, ‘locations’: [{‘line’: 2, ‘column’: 33}], ‘path’: [‘mutation inventorySetQuantities’], ‘extensions’: {‘code’: ‘variableRequiresValidType’, ‘typeName’: ‘InventorySetQuantitiesInput’, ‘variableName’: ‘input’}}, {‘message’: “Field ‘inventorySetQuantities’ doesn’t exist on type ‘Mutation’”, ‘locations’: [{‘line’: 3, ‘column’: 3}], ‘path’: [‘mutation inventorySetQuantities’, ‘inventorySetQuantities’], ‘extensions’: {‘code’: ‘undefinedField’, ‘typeName’: ‘Mutation’, ‘fieldName’: ‘inventorySetQuantities’}}, {‘message’: ‘Variable $input is declared by inventorySetQuantities but not used’, ‘locations’: [{‘line’: 2, ‘column’: 1}], ‘path’: [‘mutation inventorySetQuantities’], ‘extensions’: {‘code’: ‘variableNotUsed’, ‘variableName’: ‘input’}}]}

I search as well in the PostMan definition, I can Find inventoryAdjustQuantities & inventorySetOnHandQuantities method but not InventorySetQuantitiesInput

so this mutation is it available ?

thanks in advance

1 Like

I got the same error and more specifically (Error: Failed to set inventory quantity: InventorySetQuantitiesInput isn’t a defined input type (on $input)). I learned that inventorySetOnHandQuantities is deprecated which is why I’m using InventorySetQuantitiesInput.

Hi @seeker00 thanks a lot for you input.

Indeed you’re right I did not notice this icon “deprecated” :wink:

have a nice day

Just to clarify, you need to use the 2024-07 or later version of the API for the InventorySetQuantitiesInput to work.

1 Like