Creating a new product and add to specific sales channels

I am developing a private app for a customer on shopify plus. The store already has the write_publications scope enabled. When creating a new product, not all products go to all sales channels.

Looking at the GQL api for productCreate, I can see that I’m currently able to set the ProductInput.productPublications field to specify which sales channels this new product should be published to. However, that field is deprecated. It is convenient to be able to publish a product AND specify channels in one request. My current thinking for a workaround is:

  1. Publish the product with a “draft” status

  2. Use productPublish(...) to set the appropriate sales channels for the product

  3. Use productUpdate(status='active') to set the status active

Does anyone know how to perform this operation in 1 request (as opposed to 3?)

1 Like