Category attributes guide
Fix “must be a valid reference” errors when importing category metafields
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.
Common causes
- The entry (for example “navy” under shopify--color-pattern) was never created in this store.
- The handle is different from the name: an entry may be called “navy-1” or something unexpected.
- The value is a display name (“Navy”) instead of a handle (“navy”).
- The product has no Product category, or its category doesn’t include that attribute.
Fix
- Load your export in the Category Attributes Filler.
- In step 4, copy the lookup query into Shopify’s GraphiQL app and paste the result back.
- If values are missing, tick the confirm box, run the enable and create mutations, then run the lookup again.
- Download the CSV and import a one-product test first.
More guides
Based on product CSV guide, Standard Product Taxonomy and Link metafields to product options.