All things Shopify and commerce
Hi , I am trying to sync a product from shopify to a sales channel using graphQL but it always gives an error saying invalid ID. But I checked both ,the channel id and the product ID, are correct. Below is a code snippet. Can anyone suggest something ?
mutation publishablePublish {
publishablePublish(
id: "gid://shopify/Product/[ProductID]",
input: [
{
publicationId : "gid://shopify/Apps/[ChannelID]"
}
]
) {
publishable {
availablePublicationCount
publicationCount
publishedOnCurrentPublication
}
shop {
id
}
userErrors {
field
message
}
}
}
I have this exact problem, did you find the solution?
Got the solution for this?
I think we had to talk to support and get the publication api turned on.
I also had to contact support to activate the following scope: write_publications.
However, even with that I kept getting the invalid ID issues. I tried multiple IDs similar to yours, but none seemed to work. Contacted support again to see if they could help me with the ID format, but for some reason this is out of their area of support. The issue seems to be in the resource ID not the channel ID according to my testing.
I'll post my workaround, but as a disclaimer this isn't the ideal solution.
Programming Language Ruby 2.3.4 and the Shopify gem 4.12.0
Alternative GraphQl Mutation: PublishablePublishToCurrentChannel
Requires:
Why is this not an ideal solution? Because it forces you to reinitialize the Shopify gem (and ShopifyAPI::GraphQl module, which is expensive). Anyway, since the ShopifyAPI Gem is thread safe I delegated this mutation to a background job and had no issues so far.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024