Product sync

Product sync enables buyers to search, sort, and filter products across multiple shops in the marketplace. Product sync enables more customized search and filtering from products across shops.

Product sync requires your database to have the relevant information for each product in the marketplace. However, Shopify doesn't fully support product sync out of the box at this time. It's your responsibility to determine how best to build product sync, given the tools that Shopify makes available to you. This guide will provide high-level instructions for building product sync using Shopify's APIs and webhooks.

APIs

The following are the primary APIs you can use to build product sync.

Admin API

The primary APIs you should use are the Shopify's Admin APIs, specifically the REST Admin API's ProductListing resource. This resource only returns the products published to your channel instead of all products on the merchant’s shop, which isn’t useful to your channel app.

When the merchant first installs your channel app, you can use this API to fetch all products and perform the initial sync with your database.

Access scopes

Your app will require the following access scope

  • read_product_listings

Bulk operation

You can also perform a bulk operation query on the GraphQL Admin API's currentAppInstallation common object query. For example, you can ask for the Products in the Publication object.

The query could look something like the following:

Query: POST /api/2021-10/graphql.json

Storefront API

You can also use the Storefront API to retrieve information about a product, specifically the Product APIs.

Querying the Products object will return a list of products that a merchant has published to your channel app.

Querying the ProductVariant object will return additional product details.

Access scopes

Your app will require the following access scope

  • unauthenticated_read_product_listings

Admin API versus Storefront API

It's important to consider rate limits when you decide how to build your product sync. Although the Storefront API only returns information that's relevant to your channel app, the API is rate-limited by IP. This would have an impact on your backend.

The Admin API does not have this issue. However, the ProductListing resource is currently only available in the REST Admin API and not the GraphQL Admin API.

Webhooks

Subscribing to webhooks is essential to doing product sync correctly.

You can subscribe to HTTPS webhooks using either the GraphQL Admin API or the REST Admin API. Some useful webhook topics are product_listings/add, product_listings/remove, and product_listings/update. These will only share updates to products that are published to your channel app. For supported topics, refer to the GraphQL Admin API and REST Admin API webhook reference pages.

In addition to HTTPS webhooks, you can also use Amazon EventBridge and Google Cloud Pub/Sub instead. For more information, refer to the Webhooks Configuration Overview.

Putting it all together

By using the APIs and webhooks, you can maintain your own datastore of all the products available to the marketplace.

  • You can have a checkpoint DateTime stored on your end that will indicate the last time products were synced. Any products that have been updated in Shopify after this time will need to be synced to your datastore.

  • You can query specifically for products with updated_at times that are past your checkpoint DateTime, to reduce the query cost and obtain only the products that you need to update on your end.

  • You can use the REST Admin API for an initial product sync, and then subscribe to the appropriate webhooks to ensure any updates to products are synced with your channel app.

  • You can re-query the REST Admin API using the product_listings/update webhook or the bulk queries to ensure products on your end are kept up to date.

Next steps