Assign Products to Channels (Instagram, Google Merchant, Facebook) via API

Hello!

I would like to assign products to the different channels (Instagram, Google Merchant, Facebook) via API.
Manually set channels reset on product reimports and updates via API.
So I intend to set it via API immediately.

I already send on product create:

“published_scope”: “global”,

But when I read the product it is:
“published_scope”: “web”,

The product reads:

"created_at": "2023-03-01T17:42:15+01:00",
"handle": "abendkleid20100",
"updated_at": "2023-03-30T16:22:02+02:00",
"published_at": "2023-03-01T19:40:03+01:00",
"template_suffix": null,
"status": "active",
"published_scope": "web",

That could to be a reason for vanishing products on reimport.

Also there are some fields that would be very useful to set for the channels:

  • gender
  • age group
  • custom product
  • new/used
  • active

I have assigned the write_channels, read_channels role but can’t find the API calls to see these fields.

I’d appreciate if someone could point me to the right direction.
Thank you.

1 Like

I found these resources, but could not yet solve the issue:

1 Like

Hi @friendoftheroot :waving_hand:

To use the publishablePublish mutation, the app will first need to be granted the write_publications access scope. Can you try requesting this scope on the shop and seeing if the issue is replicable? I think this should solve the issue, but let us know if it doesn’t, happen to dig in further if need be.

Al | Shopify Developer Support

1 Like

This is the solution:

https://community.shopify.com/c/shopify-apis-and-sdks/publish-product-to-all-sales-channels-graphql/m-p/1939226/highlight/true#M87668

First, get the channels list:

Then call ‘publishablePublish’: