Best Way to automate updating large amount of Skus

Hi,
What is the best practice for updating the onhand of a lot of SKUs at once?

I noticed the graphql api as inventory_add and inventory_remove. Is there an inventory_set? (To set at a specific amount?)

Basically, our ERP dumps out a file of about 50k skus (out of 500k) every night with their onhands. I want to automate updating the skus in shiphero from this file.

My thought process is: pull down all the skus from shiphero (500k!!!) find the delta (ones that have changed onhand levels between what the ERP file and the shiphero results, then use a mutation to set the ones that have changed.

It seems like there might be a better way to do this. Any ideas?

Thanks,

I don’t have a suggestion of a better way, but something that you’ll quickly run into is the credit limit on API usage. It’s currently set at 5000 per hour. I haven’t tried mutations (updates) myself yet, so I’m not sure if the credit cost is different, but in general for simpler queries (requests) I find that requesting 100 records uses 101 credits . If the same holds true for mutations, it would take you 11 hours to update 50,000 skus. Updating 500,000 skus would take daaaaays.

2 Likes

Hi Chris!
For updating On Hand inventory you could use the warehouse_product_update mutation, using the sku, warehouse_id and on_hand.
On the other hand, I agree with Jeremy on the credit part.
Will you be updating the 500k at once, constantly? or just the ones with actual inventory change?

@chrisshoes This can be done in different ways. Let me explain a bit.
First, you can also use warehouse_product_update to set the on_hand directly.

Now talking about syncing your data with shiphero, we have ways of getting changes that occurred on our side, you have the webhooks and there’s also the query inventory_changes that can be filtered by sku, warehouse, location and data ranges.

In your case, looks like you are trying to sync with us the changes detected on your side, and that might be a bit more trickier. At first I would say, just for that is probably not necessary to download the entire inventory. You could just have a mechanism for detecting those that changed on your side, and then check those products in our API. This way you would be only hitting our api for those products that had changed on your side, reducing the amount of unnecessary requests. The flow would be:

  • detect changes per sku on your side
  • check each sku querying products or warehouse_products by sku
  • if outdated on our side, use the warehouse_product_update mutation to set the on_hand

Does that make sense?

Yes this makes sense.

Is there a way to update multiple SKU onhand at once using the warehouse_product_update mutation? or do they need to be one request at a time?

Thanks,

@chrisshoes I’m afraid there’s no bulk operation for updating sku’s on_hand for now, so it has to be made one by one.

Hmmm I’m still thinking about if there is another way to do this.

Are there other options outside of the API to do this? (and outside of a manual CSV upload)

For example, with Shopify we provide a URL that is simply a list of SKUs and their OnHands. Shopify pulls this every couple hours and updates the changes automatically.

Do you have anything similar?

Or is there a way to automate CSV inventory change upload? (Rather than having someone do it manually)

There’s no such functionality in our app yet, we are thinking about such feature but don’t have an ETA.
Out of curiosity, the url you provide to shopify points to a csv file with just skus and on_hand values?