Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Inventory Update With Absolute Value Specification

Inventory Update With Absolute Value Specification

tanakatanaka
New Member
4 0 0

Thank you for your help.
(Since I am in a situation where I cannot try GraphQL, I asked here)

 

I would like to update the stock quantity with an absolute number.


Is it possible with the following method?

 

Example: When updating the stock quantity from "10" to "15"
1. The number of stock is "10"
2. Disable once with "inventoryDeactivate"
3. Activate again with "inventoryActivate" and specify "15" in "available"

Reply 1 (1)

HunkyBill
Shopify Partner
4853 60 568

Without you explaining more, it is hard to answer. You understand setting absolute numbers no longer makes sense since inventory items and their levels are distributed across locations. Even if you only have one location, you still need to take into account that issue. Plus, when you update your count, you have no idea if items are not there due to them simply being off the shelf and in a cart, soon to be returned without  a checkout.

Meaning, go back to the pattern recommened, it does not require GQL anyway. Update your levels with the DELTA change you want to see. If Shopify tells you 10, and you have 15, your delta is +5, and you can use RestAPI to indeed provide that item, at that location with a delta of +5.

Setting absolute numbers, IMO, was left behind 6 years ago or so...

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com