How do to access 'Category Metafields' in Liquid?

Topic summary

Initial Question:
Users discovered new ‘Category Metafields’ in Shopify’s product creation interface (shown via screenshot) but couldn’t find documentation on accessing these values in Liquid code.

Early Responses:

  • Shopify Support initially confirmed these metafields were not accessible via Liquid or other means
  • Support indicated they might consider adding this functionality in the future
  • Some confusion arose around using product_option_value.swatch.color for color swatches, but this relates to product options, not category metafields

Solution Provided:
Category metafields are accessible through the shopify namespace:

  • Navigate to admin.shopify.com/store/<store name>/settings/custom_data/product/metafields to find the namespace, key, and return type
  • Access via standard metafield syntax: product.metafields.shopify.[key].value
  • Example: firstProduct.metafields.shopify.size.value

Key Clarification:
Category metafields and product options are separate features, though they may display similar names if linked. The confusion stemmed from conflating these two distinct Shopify features.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

We’ve only just seen the newer ‘Category Metafields’ when creating a product in Shopify:

My question is: how do I access the value of this in Liquid? It would be incredibly handy to determine some display functionality based on the product category. But I can’t find anything in the docs or online. Is it simply part of

product.metafields

…but with a standardised name?

1 Like

Dieing to know aswell. Can’t be so difficult to provide users with a basic doc upon adding new features right?

I had a response from Shopify Support when I emailed them about this, and currently it’s not accessible via Liquid (or any other means, AFAIK).

They have said they might consider it as they can see the usefulness, but currently it’s not possible.

Looks like i’m seeing them being used on live themes. How are they rendering them? via APIs?

I believe, dispite the feedback from shopify, that the values can actually be accessed through a “product_option_value”. I only managed to do it with the option Color so far. Maybe its just that this was specifically linked somehow. Anyway. I had to add color swatches to a customer store and could access them through the product_option_value.swatch.color

It looks somewhat like this:

{% unless collection.handle == "fussmatte" %}
            
            {%- for option in card_product.options_with_values -%}
              {%- for value in option.values -%}
                {% assign variant = value.variant %}
                
                {% if option.name == "Farben" or option.name == "Colors" or option.name == "Color" or option.name == "Farbe" %}
                    
                      
                        
                        
                    
            
                {% endif %}
              {% endfor %}
            {% endfor %}
          

          {% endunless %}

Thanks so much for this :folded_hands: . Worked perfectly after over 24 hours trying to find a solution to it.

Maurice unless I am not following, the above code only returns the product options, it has nothing to do with the category metafields.

You can assign a product to a category and then a list of category metafields will become available on the product.

You can access them in the same way as standard metafields, but using the shopify namespace.

To see the namespace, key and return type (in this case metaobject (list)), check the relevant metafield definition here:
https://admin.shopify.com/store//settings/custom_data/product/metafields

Example:

{% liquid
  assign firstProduct = collections["all"].products.first
  assign sizeMetafield = firstProduct.metafields.shopify.size.value
%}
<script>
  console.log("productId", {{ firstProduct.id }});
  console.log("sizeMetafield", {{ sizeMetafield | json }});
</script>

There is some confusion in these comments around options, which is perhaps because you can link these category metafields to the product options, and they would therefore display the same name, but options and category metafield values are not necessarily linked.