Hiya, I am having trouble retrieving a custom metafield of a product using the GraphQL API.
I am trying to retrieve metafield supersessions in the namespace custom, so custom.supersessions.
This is my original query:
query getProductsWithMetaField($first: Int!, $cursor: String) {
products(first: $first, after: $cursor) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
id
title
vendor
variants(first: 1) {
edges {
node {
sku
price
}
}
}
}
}
}
}
This is how I tried to retrieve te metafields but failed because key and namespace can not be used together in this context:
query getProductsWithMetaField($first: Int!, $cursor: String) {
products(first: $first, after: $cursor) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
id
title
vendor
variants(first: 1) {
edges {
node {
sku
price
}
}
}
metafields(first: 1, namespace: "custom", keys: "supersessions") {
edges {
node {
value
}
}
}
}
}
}
}
I am however struggling to find a correct way to get this metafield whereas I have tried several options but was not able to find a solution.
Thanks in advance