I no longer having permission errors.Still, using publishablePublishToCurrentChannel fails:
{'userErrors': [
{'field': ['id'], 'message': 'Channel does not exist'}]}}
this is the mutation FTR:
mutation PublishToCurrentChannel($productId: ID!) {
publishablePublishToCurrentChannel(id: $productId) {
userErrors {
field
message
}
}
}
I’m trying an alternative. Listing the publications available and using publishablePublish
operation.
mutation = """
mutation PublishablePublish($id: ID!, $input: [PublicationInput!]!) {
publishablePublish(id: $id, input: $input) {
publishable {
... on Product {
id
title
}
}
shop {
id
name
}
userErrors {
field
message
}
}
}
"""
variables = {
'id': 'gid://shopify/Product/9924360339751',
'input': [
{'publicationId': 'gid://shopify/Publication/193971683623'},
{'publicationId': 'gid://shopify/Publication/193971814695'}
]
}
This returns no errors but I don’t see the publishing channels added to my product either.
{'publishablePublish': {'publishable': {'id': 'gid://shopify/Product/9924360339751',
'title': 'Mulberry Protection'},
'shop': {'id': 'gid://shopify/Shop/81568071975',
'name': 'Mulberry Test Store'},
'userErrors': []}}
Really sad such a common pattern is this underdocumented and obtuse.