0
votes

I'm building a Shopify App and I got stuck as the app was behaving strangely.

I investigated the issue and I found out that saving a product with the Shopify API and then asking Shopify to read the just saved values still outputs outdated information.

Reading the product again after a few seconds outputs the true values of the saved product.

It seems Shopify is caching the query of a product and for a few seconds (with my tests the threshold seem to be 7 seconds) still replies with old data. Is this true?

In this case is there a way to tell Shopify to refresh the data of a product? For example in Ruby on Rails I could just use the ".reload" method on the object.

My problem is that if a user is using the Shopify website admin and updates a product rapidly - lets say it is entering updated stock quantity for different variants - the product-update webhook is called rapidly and the second webhook call doesn't read the changes made by the first webhook call.

Thanks!

1

1 Answers

0
votes

maybe someone from shopify will have a better answer but I've noticed the same behaviour - my assumption wasn't that it was caching, but that the changes get queued up, so there can be a delay till its processed. I worked around it by adding a delay to my webhooks processing - so my script responds right away when the webhook comes in (with a 200, and closes the connection), but then delay acting to give changes time to take effect before applying my changes.