Category attributes guide
How to fill Shopify category metafields with a product CSV
What you’ll need
Your products export CSV (with each product’s Product category set)
How to get this: Your products export CSV
- Products › Export › All products › Export products.
- Small exports download; big ones arrive by email.
Shopify’s free GraphiQL app (with read_products, read_metaobjects access)
How to get this: Shopify’s free GraphiQL app
- Install it once from shopify-graphiql-app.shopifycloud.com: enter your store address, tick the access listed here, click Install and approve.
- Then open it any time from Apps › Shopify GraphiQL App in your admin.
Shopify’s product importer, to load the result
How to get this: Shopify’s product importer, to load the result
It’s in Products › Import. Export a backup first: an import can’t be cancelled once it starts.
The columns
Shopify’s sample product CSV includes “Color (product.metafields.shopify.color-pattern)” with the value “green; gray; red”. Other attributes use their handle as the key, like “Fabric (product.metafields.shopify.fabric)”. Color is the exception: its key is color-pattern.
Product category,Color (product.metafields.shopify.color-pattern),Fabric (product.metafields.shopify.fabric)
Apparel & Accessories > Clothing > Clothing Tops > T-Shirts,navy; gray,cottonWhy values are handles, not names
A category metafield is a list of references to metaobject entries of a standard type such as shopify--color-pattern. Each entry has a label (“Gray”) and a link to a value in Shopify’s taxonomy. The CSV refers to the entry by its handle. A store only has entries for values someone has used, which is why an import can fail with “must be a valid reference”.
Make sure the values exist
Our tool writes a read-only lookup for GraphiQL that lists your store’s entries, so the CSV uses their real handles. For values your store doesn’t have yet, it writes metaobjectCreate mutations that add them, with an undo.
More guides
Based on product CSV guide, Standard Product Taxonomy and Link metafields to product options.