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.

Update multiple inventory items? (Stock levels)

Update multiple inventory items? (Stock levels)

Joe_C1
Excursionist
40 0 5

At the moment, I have a script which updates stock levels one at a time at a rate of 25 per minute. With 700+ products, this takes time. 

Is there an API which supports me dumping multiple inventory updates in one API call? 

Replies 4 (4)

Joe_C1
Excursionist
40 0 5

Doesn't look possible to update multiple at once, but I can get a list of all the items and compare it with the warehouse inventory to find mismatches. This will reduce the amount of calls. 

 

I found what I were looking for. 

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

Retrieve inventory levels at a single location

GET /admin/inventory_levels.json?location_ids=905684977

 

Edit: This doens't return anything useful really.

Aleks1
New Member
10 0 0

Hi Joe,

I think is something a few people are investigating in light of the recent API changes (previously you could at least batch up changes for variants per-product).

It appears that graphql is the way forward long-term (and something Brian here has been looking into too), but from this post (https://www.shopify.co.uk/partners/blog/multi-location_and_graphql) it seems that only adjustments are currently supported at present (and reading Brian's posts maybe it may not make much difference anyway speed-wise...).

I'm sure others may offer alternative suggestions, but the way I see it, the options are probably.

1. As you've mentioned minimise API calls by updating only where changes in qty are actaully required by retriving inv qty levels before updating (using that endpoint you've mentioned) i.e. don't blindy push unessesary updates (appologies if your script is already doing this). You're going to need to know the inventory_item_ids of your products to make use of this.

2. Create a small web-app as opposed to a script, use your script for an initial sync and occasional reconciliation, then register appropiate webhooks to be notified of changes to stock levels and only updating where required (so similar to the above, but possibly more efficient depending how often you're syncing).

3. Experiment with graphql and see how it works for you (calculating then sending adjustments in the meantime rather than setting direct values if thats ultimately what you require).

If I think of anything else I'll let you know.

Cheers,

Aleks.

Aleks1
New Member
10 0 0

I've just thought about what I just posted here, and it might (completely understandibly) fall foul of Shopify's terms of use (or encourage abuse), so have decided to remove the suggestion.

Aleks.

Hein
Tourist
7 0 9

How ridiculous of Shopify. I run into the same problem. I'd think it'd be rather easy to implement. 

For the price of the shopify plus, I'd actually expect better options. (why also not native product bundles, in stead of spending another $100 monthly, unlimited variations, etc)