+1 for also needing this.
Main reason: If you have any products in your store that are set to 'Keep selling when out of stock' so you can take Pre-Orders and Backorders, it creates major problems for 3rd party sales channels like Amazon and EBay. We use a Pre-Order app to properly communicate backorders to our customers on Shopify before they place an order, but these channels have no way of knowing that the product is on back-order and so will take orders as if the product is in stock. People who order on Amazon/EBay are not expecting any delay in shipping so they will almost always cancel their order once they learn the item is backordered and in turn leave a bad review.
With API access, a 3rd party app could automatically unpublish products from Amazon/Ebay when they go out of stock and solve this major problem for us.
Alternative: Please make the 'Keep Selling When Out Of Stock' setting channel-specific in Shopify so we could turn it off for those channels, and no 3rd party app or API access is needed to solve this particular problem.
This is now possible using the GraphQL Admin API and the following queries:
The first approach uses a bit of discovery to find the "Publication" you'd like to publish resources to by using publications query, each node in the response is a Publication Object and will include a mysterious Shopify Publication GID such as gid://shopify/Publication/00012345 along with the Publications name - for us developers this will be the name of our App.
Now you're able to call the publishablePublish endpoint, this expects a "publishable" Shopify Resource GID such as gid://shopify/Product/000123456 and also the Publication GID you'd like to publish too.
Alternatively you can skip discovery and just call the publishablePublishToCurrentSalesChannel with the Shopify Resource GID of your choice, this will publish the publishable to the requesting App's Sales Channel.. I assume - the description (ever descriptive) just says:
Publishes a resource to current channel.
I haven't tried this, I assume it doesn't work if your App is not a Sales Channel and I also assume it might work if your app is a Sales Channel.
With a bit of luck, a lot of assumptions and a lot of requests you'll be able to publish all of your products (and other "publishable" resources) to all of your Sales Channels! Woohoo!
Having to publish one at a time on a heavily rate limited API is obviously a very poor solution, it also raises doubt over the future of that ProductListing thing - is that still a thing? maybe that'll be deprecated and replaced by what Shopify is now calling a "Publishable"? Who knows.. 🤷♂️ I'm sure they'll announce it at
The Hunger Games Unite.
Bye all, have a great weekend!
I have worked through this in GraphQL in the past and I always ended up with multiple failures due to not being "approved" for the permission scope required to use that part of the API. Do you know if this is now exposed for all devs to use? I see you're referencing the release candidate version (2020-04) in your links - is this what you tested with?