Sales channel - creating products and returning information from an App trough API

Hi guys,

I have 2 very specific questions about building a sales channel App. We’ve developed an App working as a Sales Channel, and our customers can publish / unpublish products from their own product page (sales channel section), but also from our App dashboard.

References:

https://shopify.dev/apps/channels

https://shopify.dev/api/admin-rest/2022-04/resources/productlisting#put-product-listings-product-listing-id

I have two questions and we can’t find how to solve them through the documentation:

  • When a merchant install our App the first time and we sync their products from Shopify to our App, is it possible to auto-check the publishing option for each product in the Shopify product page / Product status section? Similar to other sales channel, e.g. Facebook: when you install the Facebook App, automatically sync / publish / check as published all your products
  • When someone publish/unpublish a product form its Shopify product page to our sales channel, our App is automatically updated with this info. But If someone publish/unpublished a product from our App dashboard instead of the Shopify product page, how can the Shopify API read this check/uncheck and return this information updated to the product page / Product status section?

Thank you in advance!

Hey,

You need two different approaches here, let me break it down for you by the points.

  1. Syncing of Products
    Once a user installs your app you must call the products API in order to get all the products. And register a webhook for products/create and products/update. So in the future, if they add a new product you will get the data via webhook.

2. Product status
You can use products-update API to publish/unpublish a product the details can be found below;
https://shopify.dev/api/admin-rest/2022-04/resources/product#put-products-product-id

Let me know if you need any other help?

Regards,
Mritunjay
ReturnPrime