Skip to main content
FilterIQRequest access
Menu
Back to blog
Filters

How to Set Up Metafield Filters on Shopify

Metafields are one of Shopify's most powerful features for structured product data — and one of the most underused for filtering. While most merchants rely on tags and product types for their filter setup, metafields offer a cleaner, more reliable, and more scalable approach.

This guide walks through what metafields are, why they're superior for filtering, and how to set them up effectively.

What Are Shopify Metafields?

Metafields are custom data fields that you can attach to products, variants, collections, and other Shopify resources. Unlike tags (which are simple text strings) or product types (which are a single value), metafields have defined types — text, number, date, boolean, color, dimension, and more.

For example, instead of tagging a product with "material-cotton" and "material-polyester" (which requires parsing the tag format), you can create a metafield called "Material" with type "list.single_line_text_field" that stores clean, structured values like ["Cotton", "Polyester"].

Why Metafields Are Better for Filters

Typed Data

Metafield definitions specify a type and can include validation rules. They can reduce formatting errors, but do not establish that a value accurately describes the product. Missing values and conflicting definitions still need review.

The field type informs validation and display choices, but each filtering implementation supports a particular set of sources. Check Shopify's supported filter types when using Search & Discovery. Confirm the equivalent mapping during FilterIQ onboarding.

Consistent Values

Tags are freeform, which means inconsistency creeps in over time. "Blue," "blue," "BLUE," "Navy Blue," and "navy-blue" might all appear as separate filter values when they should be one. Definitions and validation rules can reduce inconsistencies, but existing values and naming choices still need review.

Namespace Organization

Metafields are organized into namespaces, which keeps your data clean. You might have "custom.material," "custom.care_instructions," and "custom.country_of_origin" — all clearly organized and separate from Shopify's internal metafields.

Better Performance

Structured values can make filter mapping and validation easier. Response time depends on the search implementation and index configuration; a metafield is not inherently a performance guarantee.

Setting Up Metafields for Filtering

Step 1: Plan Your Filter Attributes

Before creating metafields, decide which product attributes you want as filters. Common choices include:

  • Material/Fabric — text list (Cotton, Polyester, Wool, etc.)
  • Size — text list or number (S, M, L, XL or 6, 7, 8, 9)
  • Color — use the existing option or category attribute where appropriate; confirm how swatches map to it
  • Weight — record units consistently and confirm that the chosen filter supports the source type
  • Origin Country — text describing the product origin, rather than the shopper's location
  • Season — text list (Spring, Summer, Fall, Winter)
  • Age Group — text list (Adult, Kids, Baby)
  • On Sale — boolean (enables toggle filter)

Step 2: Create Metafield Definitions in Shopify

Use the product metafield definitions area in Shopify admin. Follow Shopify's current definition instructions and check for a suitable existing definition first. Key decisions for each:

  • Namespace and key: Reuse appropriate existing definitions and confirm who owns the namespace before writing values. Avoid creating competing fields for the same attribute.
  • Type: Choose the type that best represents the data. Use "list.single_line_text_field" for multi-value text attributes.
  • Validation: Add validation rules where possible. For a "Material" metafield, you can define a list of accepted values.
  • Description: Document what the metafield is for — your future self will thank you.

Step 3: Populate Metafield Data

This is the most time-consuming step. You need to add metafield values to every product. There are several approaches:

  • Manual entry — fine for small catalogs (under 50 products), tedious for anything larger
  • Bulk editor — Shopify's built-in bulk editor lets you edit metafields across multiple products
  • Bulk import tools — verify support for the specific metafield types and keep a backup before importing changes.
  • Shopify API — for programmatic updates, use the Admin API to set metafield values
  • Assisted suggestions — FilterIQ's data review workflow can propose candidate values from product data. Inspect the source and confidence before approving a value; a suggestion is not verified product information.

Step 4: Connect Metafields to Filters

Once your metafield data is populated, connect each metafield to a filter in your search and filter app. The configuration typically involves:

  • Selecting the metafield as a filter source
  • Choosing the filter type (text list, swatches, range slider, toggle)
  • Setting the display label (what shoppers see)
  • Configuring sort order for filter values (alphabetical, by count, custom)
  • Setting collapse behavior (expanded by default, collapsed, or auto)

Step 5: Test and Iterate

After setup, test your filters thoroughly:

  • Do filter values appear correctly for all products?
  • Are there any empty or inconsistent values?
  • Do multi-select combinations return the expected products?
  • Is response time acceptable on representative devices and networks?
  • Do filters work correctly on mobile?

Migrating from Tags to Metafields

If your store currently uses tags for filtering, plan the mapping and a way to recover before changing the live configuration:

  • Map existing tags to metafield definitions — identify which tags correspond to which attributes
  • Create metafield definitions in Shopify admin
  • Write a migration script (or use a bulk tool) to read tag values and write corresponding metafield values
  • Verify data quality before switching your filters to use metafields
  • Update your filter configuration to point to metafields instead of tags
  • Keep tags temporarily as a fallback until you've verified everything works

Advanced Metafield Filtering

Variant-Level Metafields

Some attributes vary by variant, not by product. Size and color are classic examples — different variants have different sizes and colors. Shopify supports variant-level metafields, which enable more precise filtering.

Computed Metafields

Some useful filter values don't exist directly in your product data but can be computed. "Price Range" (budget, mid-range, premium), "Discount Percentage," or "Days Since Added" are examples. You can use Shopify Flow or custom scripts to compute and store these values as metafields.

Metafield-Based Merchandising

Beyond filtering, metafields can drive merchandising rules. Boost products where "custom.is_featured" is true. Demote products where "custom.clearance" is true. The structured nature of metafields makes these rules more reliable than tag-based approaches.

Metafields represent the future of structured product data on Shopify. Investing in a clean metafield setup now pays dividends in better filters, more reliable merchandising, and a more maintainable product catalog.

Ready to improve your store's search?

Discuss your catalogue, theme and search requirements during private-preview onboarding.