Locations and inventory API

Highlighted
New Member
1 0 0

We started with Shopify about a year ago and I managed to miss the stuff about the Locations API and happily set up using `product.variants.inventory_quantity` to specify quantities. Now that's deprecated so I've learned about Locations and got it all working. However it means every update requires two API calls instead of one. It was slow before but is now even worse.

 

BTW this isn't exactly a problem to solve — I'm just asking: Am I doing this the right way, because it seems mad?!

For some background, our business (antiques) is perhaps "unusual" in that our stock consists of thousands of individual items rather than the "normal" selling large quantities of a few items. And never more than one `variant`. And we're only ever likely to have a single `location`.

Descriptions and prices are updated fairly often and these need to be processed in batches (maybe 100 items a day, as they are extracted laboriously from an ancient database which has no hope of connecting directly to any API. Don's ask!)

 

So… as I understand it, and I seem to have it working, whenever I update a `product` I need to check the returned json to find out the `inventory_item_id` and then use that in a separate call to set the quantity `available` at our `location`.

Many updates do not need to change the quantity but I've discovered that when I perform any update I receive a new `inventory_item_id` which has 0 available by default, so I still need to update that too. And what happened to the old inventory_item_id? Couldn't I just reuse it especially as apparently "There is a 1:1 relationship between a product variant and an inventory item"?  In which case why is inventory_item_id even necessary? I know others have asked that … 

I feel I'm starting to rant now — apologies.

Every API call seems to take 4-5 seconds which means several minutes per total update. Now this is doubled!

 

Botton line question — have I got this right, or have I misunderstood something?

 

0 Likes