How to Use Shopify Metafields for Product Variants
Shopify
9.17.2026

How to Use Shopify Metafields for Product Variants

Unlock richer product pages by attaching custom data to every variant — no coding required.

Shopify's default variant fields cover price, SKU, and inventory — but what about material composition, care instructions, or a per-size fit guide? That's exactly the gap metafields are built to fill, and mastering them is one of the highest-leverage moves you can make for your store's conversion rate.

What Are Shopify Variant Metafields (and Why Should You Care)?

Metafields are custom data fields that extend Shopify's standard data model. Where the platform gives you title, price, images, and stock quantity out of the box, metafields let you attach any additional structured information you need — to products, collections, orders, customers, and individual variants.

Variant metafields specifically store additional information about each product option. This data doesn't determine which variant a customer selects, but it provides crucial details about that specific variant — think fabric weight for a size L hoodie, a downloadable user manual for a particular SKU, or a per-colour care instruction.

Key insight: Variant metafields are separate from the variant option itself. Options (Size, Colour, Material) are what customers pick. Metafields are the rich data layer that lives behind each option value.

The practical upside is real: more detailed product information helps customers make confident decisions, which means fewer returns and more completed checkouts.

Three Types of Metafields That Affect Variants

Before diving into setup, it helps to know the landscape. Shopify currently offers three metafield scopes that touch variant management:

Metafield Type Where It Lives Best Used For
Variant Metafields Attached to a specific variant (SKU) Unique specs per option: dimensions, material, care label
Product Metafields Attached to the parent product Shared data: warranty, certifications, brand story
Category Metafields Tied to Shopify's standard taxonomy Structured attributes like size, colour, sleeve length — connectable to variant options as reusable entries

Category metafields deserve a special mention: when you assign a standard product category (e.g. Apparel & Accessories > Clothing > Shirts), Shopify unlocks a pre-defined set of category metafields — colour, size, neckline, fabric, and more — that you can connect directly to your variant options. Edit an entry once, and every connected product updates automatically.

Step-by-Step: Creating a Variant Metafield Definition

The process starts in Settings, not in your product editor. You define the metafield schema first, then populate values product by product (or in bulk).

  1. From your Shopify admin, go to Settings → Custom Data (previously labelled 'Metafields').
  2. Under the resource list, click Variants.
  3. Click Add definition.
  4. Give it a descriptive Name — e.g. Material Composition, Dimensions, or Care Instructions. The namespace and key are auto-populated; leave them unless you need custom API access.
  5. Select a Content Type: Single-line text, Multi-line text, Number, File (for PDFs or images), URL, Date, etc.
  6. Enable 'Give access to Storefront API requests' if you want the value to appear on your live storefront — this is required for theme rendering.
  7. Click Save.

Once saved, this definition appears as an editable field on every product's variant editor — ready to receive unique values per SKU.

Step-by-Step: Populating Values on Your Products

With the definition in place, adding data is straightforward:

  1. Go to Products → All Products and open a product.
  2. Scroll to the Variants section and click on a specific variant (e.g. Size L / Colour Black).
  3. On the variant detail page, scroll down until you see your metafield definitions listed.
  4. Fill in the value — e.g. 95% Cotton, 5% Elastane for Material Composition.
  5. Click Save.
  6. Repeat for each variant that needs a distinct value.

Pro tip for large catalogs: Use the Shopify bulk editor or a CSV import to fill metafield values at scale. Managing metafields for a handful of products is easy, but for stores with hundreds of SKUs, a bulk workflow is non-negotiable.

Connecting Variant Options to Metafields (the Reusability Play)

There's a more powerful setup beyond simply storing extra data: you can connect a variant option directly to a category or product metafield of the metaobject reference (list) type. When you do this, the option values are automatically populated from your metafield entries — and changes propagate everywhere at once.

  • Navigate to a product → Variants → click Add options like size or color.
  • If a compatible metafield exists, you'll see the datasource icon (⛁) next to it — tap or click it to connect.
  • The option values are filled automatically from your metafield entries.
  • To add a new option value, click Add new entry and fill out the fields.

The real win here is consistency: if you rename a colour entry from Black to Graphite, that change propagates to every product it's connected to — no manual updates across hundreds of listings. For dropshippers sourcing from Chinese marketplaces and adding new products weekly, this kind of centralised data management saves hours.

Speaking of sourcing at scale: if you're importing products from platforms like 1688 or Taobao, you'll often receive supplier specs in bulk. Tools like Piratify streamline that sourcing workflow, so you spend less time chasing product data and more time optimising your store. Once the data is in Shopify, variant metafields are the right place to structure it. You might also find our guide on importing product data into Shopify useful before setting up your metafield definitions.

Displaying Variant Metafields on Your Storefront

Creating metafields is only half the job — you also need to surface them to shoppers. There are two main paths:

Option A: Theme Editor (No Code)

If you're running an Online Store 2.0 theme (Dawn, Sense, Craft, or any modern third-party theme), you can connect metafields directly in the theme editor:

  • Go to Online Store → Themes → Customize.
  • Navigate to a product page template.
  • Add or select a text or content block, then click the dynamic source icon (⛁) to link it to your variant metafield.
  • Save and preview — the value will render for whichever variant is currently selected.

Option B: Liquid Code (Full Control)

For dynamic updates that change without a page reload when a shopper switches variants, you'll need a small JavaScript snippet alongside your Liquid. The core Liquid reference for a variant metafield looks like this:

  • Access it via variant.metafields.namespace.key in your theme templates.
  • Use JavaScript (or the Storefront API) to fetch the metafield value for the newly selected variant and update the DOM on the fly.
  • Without JS, the metafield will only display for the default variant unless the page refreshes.

If you prefer not to touch code, several Shopify apps handle this natively — search the App Store for 'metafield display' or 'custom fields'. Just ensure the app you choose supports variant-level data and is compatible with your current theme version.

Real Use Cases for Dropshippers & Shopify Merchants

Variant metafields aren't just a developer toy — they solve genuine merchant problems. Here are the most impactful applications:

  • Material & composition per size: A size XL garment from a Chinese manufacturer may use a different fabric blend than size S. Capture that nuance without rewriting the product description.
  • Per-variant weight for accurate shipping: Store precise shipping weight in a metafield and feed it into your carrier-calculated rates or 3PL system.
  • Downloadable spec sheets or user manuals: Attach a PDF file metafield to electronics variants so customers can download the exact manual for their model.
  • Colour swatches with hex codes: Store the exact hex value per colour variant and render true swatches in your theme — far more accurate than Shopify's built-in colour picker for niche tones.
  • Lead times per variant: If certain SKUs ship from different warehouses or have longer production runs, a 'Estimated Lead Time' metafield lets you communicate that transparently on the product page.
  • Care instructions in multiple languages: Create separate metafields for each language and use your theme logic to display the right one based on the customer's locale.

For merchants building multi-SKU catalogs from suppliers on platforms like 1688 or Tmall, this level of data granularity is what separates a professional storefront from a generic dropshipping page. See our related post on product listing optimisation for Shopify for the full picture on presenting sourced products effectively.

Common Mistakes to Avoid

  • Skipping the Storefront API toggle: If you don't enable 'Give access to Storefront API requests' when creating the definition, your metafield values won't render on the live storefront.
  • Confusing product metafields with variant metafields: Data stored at the product level is the same for all variants. Always ask: 'Does this value differ per option?' If yes, it belongs on the variant.
  • No naming convention: As your store scales, ad-hoc metafield names become chaos. Establish a clear namespace convention (e.g. product_specs.material) from day one.
  • Forgetting to populate new variants: When you add a new variant to an existing product, metafield values don't carry over automatically — you need to fill them manually or via bulk import.

FAQ

Can I add metafields to variants without a developer?

Yes. Shopify's admin currently lets you create metafield definitions and populate values entirely without touching code. Displaying them on your storefront may require minor theme adjustments, but Online Store 2.0 themes support no-code connections via the theme editor's dynamic source picker.

What's the difference between a variant metafield and a variant option?

Variant options (Size, Colour, Material) are what shoppers use to choose a specific variant. Metafields are the additional data layer attached to each resulting variant — they provide context and information but don't drive the selection logic themselves.

How do I display different metafield values when a shopper switches variants?

For live, no-reload updates, you need a small JavaScript snippet that listens to the variant selection event and fetches or swaps the relevant metafield value in the page DOM. If your theme doesn't support this natively, a metafield display app from the Shopify App Store is the easiest solution. You can also use the Storefront API to retrieve variant metafields dynamically.

READY TO SOURCE SMARTER?
Piratify connects your Shopify store directly to China's biggest wholesale marketplaces — 1688, Taobao, Tmall, JD and more — with sourcing and fulfillment built in. Skip the middlemen, find better products, and ship without the hassle.
Arrow right icon
z
z
z
z
i
i
z
z
Start sourcing cheaper today.
Join Piratify and access wholesale prices from China's 6 biggest marketplaces.