A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello guys I have the below GraphQL variable to create a product.
{
"input" :
{
"productType" : "Single Built In Oven",
"title" : "AEG Single Oven Electric BSK792380B - Black Glass",
"productPublications" :
[
{
"publicationId" : "gid://shopify/Publication/76438962261"
}
]
}
}
I have introduced productPublications as it seems this is required to get it into my online sales channel and sure enough... where I run it from the GraphiQL app it runs fine.
I can also run the below from postman and it runs fine:
{
"input" :
{
"productType" : "Single Built In Oven",
"title" : "AEG Single Oven Electric BSK792380B - Black Glass",
}
}
However when I try and run the first one from postman I get the below:
{
"data": {
"productCreate": null
},
"errors": [
{
"message": "Access denied for productCreate field. Required access: `write_products` access scope.",
"locations": [
{
"line": 3,
"column": 3
}
],
"path": [
"productCreate"
],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/api/usage/access-scopes",
"requiredAccess": "`write_products` access scope."
}
}
],
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
But I clearly have permissions otherwise I wouldn't be able to post the product (without productPublications )
from postman.
Why am I getting these permission issues when I try and productCreate with productPublications as an input?
It seems this a Shopify Plus only feature and you have to ask for it to be allowed?
I have a similar problem but I actually want the product published to POS and a buy button. I saw a solution for online store using the REST api here: https://community.shopify.com/c/shopify-apis-and-sdks/product-created-via-api-not-listed-to-sales-ch...
That doesn't really work for my use case. Let me know if you ever get the graphql api to work for any of these situations.
Hey @mattayres - thanks for getting in touch. You are correct that this is a Plus only feature. At the moment, we do limit third party apps from seeing which products are published on which specific sales channels without specific permission from Shopify without the read/write_publications scopes.
If you do need the scopes to access the Productpublications object and related objects, the best step forward would be to get in touch with our Partner Support specialists and ask them to take a look at enabling the scope for you. I can't guarantee what the next steps would be after that, but they'd be more than able to help out.
Hope this provides some next steps - let us know if we can clarify anything.
Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog