A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi is possible to update multi metafiled? I have a product with 5 metafiled is possibile update all togheter?
I try with php
$data = array('metafield' =>
array(
'namespace' => 'custom',
'key' => 'Genere',
'value' => 'Uomo',
'type' => 'single_line_text_field'
),
array(
'namespace' => 'custom',
'key' => 'style',
'value' => 'Sport',
'type' => 'single_line_text_field'
)
);
Hi @SCoccia 👋
If your app has permissions to modify all 5 metafields on the product, you can use the `productUpdate` mutation to update them using their `metafield.id`:
mutation ($input: ProductInput!) {
productUpdate(input: $input) {
product {
id
metafields (first: 5, namespace:"foobar"){
nodes {
id
key
value
}
}
}
}
}
{
"input": {
"id":"gid://shopify/Product/123",
"metafields": [
{
"id": "gid://shopify/Metafield/456",
"value": "cat"
},
{
"id": "gid://shopify/Metafield/789",
"value": "dog"
}
]
}
}
Hope that helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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
Hi thank you but Is a php page with curl not use node js...