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
    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)

Fill them from my export

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.

Header and value
Product category,Color (product.metafields.shopify.color-pattern),Fabric (product.metafields.shopify.fabric)
Apparel & Accessories > Clothing > Clothing Tops > T-Shirts,navy; gray,cotton

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