We have a private app that updates inventory for various Shopify stores via the hourly fetch_stock callback. This has worked correctly for over a year but in the last week or so, the inventory has stopped being updated (it has stopped on both existing Shopify stores and brand new Shopify stores that have our private app).
I believe it is calling https://ourapp.com/api/fetch_stock.json
In one newly associated store, where it currently has all 0s for inventory (for items fulfilled by us), I manually switched one product from being fulfilled by us to be manual and then switched it back (to trigger the fetch_stock) and it did update with a number but believe we got a 404 on the backend.
Example shop id is 462006419102
Any help is appreciated!!
I haven't been able to replicate any issues with fetch_stock on my end this morning, but I'm happy to take a look at your shop. The shop_id you provided appears to be invalid, can you double check that and provide the shop id again?
I just checked our logs for the fetch_stock URL you provided, and I can confirm the calls are happening once an hour as expected. Your server seems to be responding, but in all cases the response is empty.
I recommend installing the app on a test store with 1 product, and check your app's logging to ensure the proper response is being sent. Since your server is responding but the response is empty, I'd start by looking at whatever logic you have setup that routes requests to the desired shop's inventory.
Thanks - I will definitely check that out. If I update a product to have a different fulfillment and then change back to being fulfilled by my app, it will update the inventory correctly. Would there be a difference in the way the fetch_stock or my response is whether it is for a manual request or an automatic hourly request?
Yes, when you update a single product, Shopify's fetch_stock request will include the SKU as a URL parameter. So in that case we're only asking for inventory on that individual SKU. The hourly request wants every SKU in the response, so it doesn't contain the URL parameter.
If your app is responding correctly to the individual requests, it sounds like you just need to ensure the app responds with all SKUs for a given store if the SKU param isn't present in the request.
@_JB Can the fetch stock API ping an inventory table multiple times an hour? We would like it to retrieve all SKU's to have more accurate inventory. Does the fetch_stock API follow the leaky bucket algorithm?
@nsmith0333 The fetch_stock call happens once per hour, there's no way to change the frequency. When the hourly call happens it asks for all SKUs. This means if you're using the fetch_stock endpoint, your inventory will be synced with Shopify once per hour.