Solved

GraphQL update variants inventory to "not stocked" (unchecking "Stock at this location")

Titoiso
Shopify Partner
11 0 1

Hi, I'm looking to develop an app to automatically update variants inventory to "not stock" when quantity is "0" for specific Shopify locations that only use POS, therefore the out of stock product won't pollute the POS screen. I'm searching the REST Inventory API documentation as well as the GraphQL documentation but can't find anywhere where it's specified what query I should do. Anyone have an idea?

> Shopify Partner
> Digital Marketing, Ecommerce and Business SaaS Consultant
> Blue Ocean Strategy Consultant > blueoceanstrategy.com
> MPO Certified Consultant > creacor.com

T 514.826.8404
>>bélé solutions
bele.io
Accepted Solution (1)
Alex
Shopify Staff
1561 81 341

This is an accepted solution.

Apologies, I misunderstood your question.

 

With REST, you can DELETE an inventory level at a specific location, which is the equivalent of unchecking the box to stock that inventory at said location:

 

https://help.shopify.com/en/api/reference/inventory/inventorylevel#destroy

 

With GraphQL, there's an inventoryLevelDeactivate mutation you can leverage:

 

https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/inventorydeactivate

 

Hope that helps!

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 4 (4)

Alex
Shopify Staff
1561 81 341

You can access the "tracked" property on the inventory_item for both GraphQL and REST:

 

REST

GraphQL

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Titoiso
Shopify Partner
11 0 1
Thanks Alex, but are you sure that the "tracked" property is the one affecting the "stocked at this location" state? For me the "tracked" property have a much wider influence on the item independantly of its location:
"
"tracked": true
Whether the inventory item is tracked. If true, then inventory quantity changes are tracked by Shopify
"
> Shopify Partner
> Digital Marketing, Ecommerce and Business SaaS Consultant
> Blue Ocean Strategy Consultant > blueoceanstrategy.com
> MPO Certified Consultant > creacor.com

T 514.826.8404
>>bélé solutions
bele.io
Alex
Shopify Staff
1561 81 341

This is an accepted solution.

Apologies, I misunderstood your question.

 

With REST, you can DELETE an inventory level at a specific location, which is the equivalent of unchecking the box to stock that inventory at said location:

 

https://help.shopify.com/en/api/reference/inventory/inventorylevel#destroy

 

With GraphQL, there's an inventoryLevelDeactivate mutation you can leverage:

 

https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/inventorydeactivate

 

Hope that helps!

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

jpaulc34
Tourist
5 1 1

Hi Alex, when using inventoryDeactivate mutation on graphql, how/where do I get the inventoryLevelId?

When querying the inventoryLevels, it doesnt return the inventoryLevel ID