A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I have a metafield set up as type list.product_reference and I pass product values like this:
Array ( [namespace] => custom [key] => related_boot_mats [value] => ["gid:\/\/shopify\/Product\/6904572084410","gid:\/\/shopify\/Product\/6904572248250"] [type] => list.product_reference )
But the response only includes the first product:
[node] => Array ( [key] => related_boot_mats [value] => ["gid://shopify/Product/6904572084410"] [namespace] => custom )
I can add multiple products using the Shopify admin site, I'm just not able to do it with the API. Is there something that I need to add to allow this? Here's the query:
Array ( [query] => mutation createOrUpdateProduct($input: ProductInput!) { productUpdate(input: $input) { product { id title handle bodyHtml tags productType vendor images(first: 1) { edges { node { src } } } variants(first: 1) { edges { node { id sku price } } } metafields(first: 20) { edges { node { key value namespace } } } } } } [variables] => Array ( [input] => Array ( [metafields] => Array ( [0] => Array ( [namespace] => custom [key] => related_boot_mats [value] => ["gid:\/\/shopify\/Product\/6904572084410","gid:\/\/shopify\/Product\/6904572248250"] [type] => list.product_reference ) ) [id] => gid://shopify/Product/6904571756730 ) ) )
Solved! Go to the solution
This is an accepted solution.
Hi, there
I dont think it is a suitable way using productUpdate to updates metafield of type “list product reference” directly. I recommend metafieldsSet mutation instead.
This is an accepted solution.
Hi, there
I dont think it is a suitable way using productUpdate to updates metafield of type “list product reference” directly. I recommend metafieldsSet mutation instead.