Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

InventorySetOnHandQuantities returns null on newly created Product

InventorySetOnHandQuantities returns null on newly created Product

Woodini
Shopify Partner
2 0 0

Trying to set 'on_hand' value using 'InventorySetOnHandQuantities' on a newly created Product.
I have tried using [REST]: '/inventory_levels/set.json' before calling the [GraphQL]: 'InventorySetOnHandQuantities'

which returns null, but when I try [REST]: '/inventory_levels/connect.json' before calling the [GraphQL]: 'InventorySetOnHandQuantities' it works?

In the documents for [REST]: '/inventory_levels/set.json' it says 'If the specified location is not connected, it will be automatically connected first'.

It says it automatically connects first then isn't this supposed to work?
Or will it be better to use [REST]: '/inventory_levels/connect.json'?





Reply 1 (1)

Woodini
Shopify Partner
2 0 0

Found out that there were no change to the quantity which was causing the error.

So quantity from [REST]: '/inventory_levels/set.json' = 10 but tried to do [GraphQL]: 'InventorySetOnHandQuantities' = 10 causes error