Keeping your Shopify app’s data synchronized with Shopify’s API can be confusing at first.
Fortunately there are two different options you can pick from.
1. Scheduled cronjobs to pull data
An easy way to synchronize your data with Shopify is to make the API calls you need and save the resulting objects into your local database.
I do this using a scheduled cronjob so my users don’t have to wait for the API calls and to ensure that the data is always in sync.
Shopify’s API data includes time fields that you can use to see when things where last updated at. That way your app can skip over data that hasn’t been updated since you last checked.
2. Webhooks to push data
Webhooks are another way of synchronizing your data with Shopify.
Using a cronjob like I described above means that every time it run (e.g. hourly) your app is going to the Shopify API and PULLing data. In other words, your app triggered the interaction.
Webhooks are the reverse, Shopify triggers the interaction and PUSHes data to your app.
When an event happens in Shopify, they calling the url you configured in the webhook and pass you the relevant data based on the webhook type.
For example, when the "Brown Handbag" product is updated, Shopify sends its product data to the url of your app’s configured webhook such as
Use both in order to start the most synchronized
To have the most up-to-date and synchronized data, you need to use both. Webhooks can be your primary way of synchronizing data and a scheduled import can catch anything that webhooks missed.
Or don’t synchronize at all
But you don’t have to synchronize with Shopify. Webhooks and data synchronization in general is optional.
Depending on your app and the behavior it has, you might not need to synchronize data at all, or you might be able to just use one method instead of both.
Take a moment before you start developing any synchronization code and think about if you even need it. You might be able to just use the live Shopify API and save yourself a lot of trouble.
Would you like to learn how to improve your store, attract happy customers, and sell more products?
Learn how in the Shopify Dispatch.
Shopify Dispatch is a weekly curated newsletter with links and resources for Shopify merchants about Shopify and ecommerce.