Hello i have following Issue,
I want to get the metafield id of my sold_out_metafield to change its value in the productUpdate Mutation. My Problem is that this query is showing the metafield for some products but not for products where the metafield is not initialized with a value. How can i get the id of this metafield to set the value? or how can i initially set the value to an empty value so every id is initialized.
data = {
"query": `query {
products(first: 10, after:"${cursor}",query:"(product_type:bundle)") {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
title
tags
variants(first: 1){
edges{
node{
id
inventoryItem{
id
tracked
inventoryLevels(first:1){
edges{
node{
location{
id
}
}
}
}
}
}
}
}
metafields(first: 1,namespace:"bundle"){
edges{
node{
value
key
namespace
}
}
}
sold_out_metafield:metafields(first: 1,namespace:"sold_out"){
edges{
node{
id
}
}
}
}
}
}
}`
,
}
}
let response = await axios($, {
method: "post",
url: `https://${this.shopify_developer_app.$auth.shop_id}.myshopify.com/admin/api/2023-04/graphql.json`,
headers: {
"X-Shopify-Access-Token": `${this.shopify_developer_app.$auth.access_token}`,
"Content-Type": `application/json`,
},
data,
})
Empty Metafield Response (showing only on some products):
Expected Response:

