Mutation InventorySetQuantitiesInput is working or not ?

Solved

Mutation InventorySetQuantitiesInput is working or not ?

BenoitG
Visitor
2 0 1

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 

 

BenoitG_0-1720971720148.png

 

so this mutation is it available ?

thanks in advance

 

 

 

Accepted Solution (1)

seeker00
Visitor
1 1 0

This is an accepted solution.

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.

View solution in original post

Replies 3 (3)

seeker00
Visitor
1 1 0

This is an accepted solution.

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.

BenoitG
Visitor
2 0 1

Hi @seeker00  thanks a lot for you input. 

Indeed you're right I did not notice this icon "deprecated" 😉

have a nice day

 

Aaron_Alfson1
Shopify Partner
5 0 5

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