Hourly Fetch_Stock no longer working

AshleyMalvankar
New Member
11 0 0

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!!

 

 

 

 

0 Likes
AshleyMalvankar
New Member
11 0 0

@_JB or Shopify Staff - any insight into fetch_stock and why it is no longer working?

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 164

Hi @AshleyMalvankar,

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?

 

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
AshleyMalvankar
New Member
11 0 0

Hi @_JB ,

 

Thanks for the reply. I had a little difficulty finding the Shopify ID for some of the stores I am working with. Here is one of the their links (where there is no inventory coming in automated): 

https://talis-us.myshopify.com/

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 164

Hey @AshleyMalvankar,

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. 

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
AshleyMalvankar
New Member
11 0 0

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?

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 164

Hey @AshleyMalvankar,

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 | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
nsmith0333
New Member
6 0 0

@_JB Are there any limitations to the fetch_stock API request in the situation above? Is it possible to reduce the hourly call for all SKU's down to every 15 minutes or less?

0 Likes
nsmith0333
New Member
6 0 0

@_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? 

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 164

@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.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog