I have a sales channel and I want to read the metafield definitions or the metafield values of product listings.
Tentative 1: get metafield definitions
I tried to send the following GraphQl request:
{"query":"query ($owner: MetafieldOwnerType!) { metafieldDefinitions( ownerType: $owner, first:1) { edges { node { id key name description validations { name type value} type { name} } } } }","variables":{"owner":"PRODUCT"}}
that fails with a 500:
{
"errors": [
{
"message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 121144ea-3934-4978-ae66-9b31fb10d467-1715066226 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "121144ea-3934-4978-ae66-9b31fb10d467-1715066226"
}
}
]
}
Doing some research I found it can be a permission issue. note that the app has the permission read_product_listings.
Tentative 2: get the product listing
By querying the REST API product_listings, we do not get the meta field values
How can I get the product’s metafields from my sales channel?
Thank you