Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I have a nextJS project using shopify headless.
I have created an extra metafield for my products (ingredients). I tried following this tutorial: https://shopify.dev/docs/custom-storefronts/building-with-the-storefront-api/products-collections/me.... I already created the metafield in shopify (see the screenshot below).
The tutorial wants me to expose my metafield. I have tried this using curl. See my command below:
curl -X POST \ https://{my-store}.myshopify.com/admin/api/2024-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {my-token}' \ -d '{ "query": "mutation CreateMetafieldStorefrontVisibility($input: MetafieldStorefrontVisibilityInput!) { metafieldStorefrontVisibilityCreate(input: $input) { metafieldStorefrontVisibility { namespace key } userErrors { field message } } }", "variables": { "input": { "namespace": "custom.ingredients", "key": "custom.ingredients", "ownerType": "PRODUCT" } } }'
When running this command I get the following error:
Does anyone know how to resolve this issue?
@straatrakker sorry this might be a bit late but your namespace value should be set to custom and key value should be ingredients.