Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hello,
I need to add additional fields to a product (beyond the ones Shopify provides). Ideally, it would be some sort of key-value that I can add to a product via API or CSV and that I can later retrieve in my storefront and admin. Is there any way to do this? Are metafields the way to go?
For example, I would like to add key-values for each product like: "marking-price-1-colors": "3", "marking-price-2-colors": "5" ... etc
Hey @apiexplorer ,
Metafields would indeed be the best way to do this. You can assign Metafields at the product level or variant level.
The Metafield structure is already in key/value format. It also supports namespaces so you can have identical key names in different namespaces (e.g. facebook.category, google_shopping.category).
You can also use raw JSON strings for the Metafield value for more flexibility (e.g. nested data structures)