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
    1. Products › Export › All products › Export products.
    2. Small exports download; big ones arrive by email.

    Step-by-step guide (opens in a new tab)

  • Shopify’s free GraphiQL app (with read_products, read_metaobjects access)

    How to get this: Shopify’s free GraphiQL app
    1. Install it once from shopify-graphiql-app.shopifycloud.com: enter your store address, tick the access listed here, click Install and approve.
    2. Then open it any time from Apps › Shopify GraphiQL App in your admin.

    Step-by-step guide (opens in a new tab)

  • 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.

    Step-by-step guide (opens in a new tab)

Check my values

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

  1. Load your export in the Category Attributes Filler.
  2. In step 4, copy the lookup query into Shopify’s GraphiQL app and paste the result back.
  3. If values are missing, tick the confirm box, run the enable and create mutations, then run the lookup again.
  4. 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.