I am currently trying to publish my product to specific sales channels when I create or update a product.
After adding in the productPublications array I’m getting an error about invalid ID, “locations”:
{“data”:{“productUpdate”:null},“errors”:[{“message”:“invalid id”,“locations”:[{“line”:1,“column”:40}],“path”:[“productUpdate”]}],“__lineNumber”:0}
{
"input": {
"id": "gid://shopify/Product/XXX",
"handle": "HANDLE",
"productPublications": [
{
"publicationId": "gid://shopify/Channel/123"
},
{
"publicationId": "gid://shopify/Channel/234"
}
],
"options": [
"COLOR",
"SIZE",
"WIDTH"
],
"seo": {
"title": "",
"description": ""
},
"variants": [
{
"price": 100,
"inventoryQuantities": [
{
"locationId": "gid://shopify/Location/987",
"availableQuantity": 1
}
],
}
]
}
}
However, if I remove the productPublications and use the input below everything works.
{
"input": {
"id": "gid://shopify/Product/XXX",
"handle": "HANDLE",
"options": [
"COLOR",
"SIZE",
"WIDTH"
],
"seo": {
"title": "",
"description": ""
},
"variants": [
{
"price": 100,
"inventoryQuantities": [
{
"locationId": "gid://shopify/Location/987",
"availableQuantity": 1
}
],
}
]
}
}
I have removed most of the other data, and am not using the real shopify IDs for simplicities sake. But am still getting the error with just those few parameters. Is there something I’m missing about attaching sales channels to products? Any advice would be appreciated.
I have verified all the IDs to ensure they are correct. The locations and sales channels’ IDs are all correct.
Thank you