Tendrils.io
Insights

Shopify data · 3 min read

Shopify variant metafields: what they are and how stores actually use them

Product metafields describe the product. Variant metafields describe the one version the customer is actually buying, and that is where honest delivery badges live.

A forklift moving pallets between tall warehouse shelving racks
Every badge on a product page is a promise. Variant metafields are where that promise is stored, one sellable version at a time.

What a variant metafield actually is

A metafield is a custom field Shopify lets you attach to almost anything: products, variants, orders, customers. A product metafield describes the whole product. A variant metafield describes one sellable version of it, the king size, the walnut finish, the exact SKU a customer puts in the cart.

That distinction matters more in furniture than almost anywhere else. A panel bed in queen and king shares one product page, but the two ship on different trucks on different schedules. Put the lead time on the product and one of your variants is lying.

Every metafield has four parts: a namespace that groups it, a key that names it, a type that validates it, and the value itself. Ours live in the variant-profile namespace under the variant-special key. When a vendor feed says a sofa now takes six weeks instead of two, the pipeline writes that to one field on one variant, and the theme reads it back.

Three ways to write them

The Admin UI is where most stores start. You define the field under Settings, Custom data, Variants, then edit values variant by variant. For a dozen SKUs that is fine. For the 42,865 products we sync it is not a process, it is a full time job.

The programmatic route is GraphQL. The metafieldsSet mutation creates or updates metafields on any owner in one call, so a single request can write the lead time field for twenty five variants. It returns userErrors next to the result, which is where validation failures surface, including the type mismatches covered below.

For catalog scale there are bulk operations, which run the writes asynchronously and produce a result file you download afterward. Our inventory sync uses plain metafieldsSet because badges need to land within the minute, but a bulk operation is the right tool for a one time backfill.

The use case that pays for it: delivery badges

The badge reading Ships in 2-5 weeks on a Jennifer Furniture product page is not theme copy. It is a variant metafield, written per variant by the sync and read per variant by the theme when a shopper selects a size or finish.

Furniture is the reason it has to live at variant level. Stock ships by LTL freight on one timeline, white glove delivery on another, and a special order configuration can run 8-14 weeks. One product level value cannot tell three true stories at once.

The value sits in the variant-profile namespace under variant-special. When a feed like ESF reports a component shortage, the lead time changes on exactly the variants built from it, and nothing else on the page moves.

Smart diffing, or why you never write on every sync

The temptation is to write every metafield on every sync run and let Shopify sort it out. Do not. The Admin API throttles by calculated cost, and a no-change write costs the same as a real one. Multiply a pointless write by forty thousand products and their variants and the sync spends its whole budget doing nothing.

The fix is unglamorous: before mutating, compare the value you intend to write with the value already on the variant. Same value, no mutation. We call it smart diffing, and it is the difference between a sync that finishes in minutes and one that gets throttled into the next hour.

It also protects history. When badges once froze for weeks because a vendor changed the case of a status field, the diff is what told us the writes had quietly stopped matching.

The pitfalls that actually bite

Metafield definitions must match across stores exactly. A field created as multi_line_text_field on Jennifer Furniture and single_line_text_field on Jennihome accepts a write in one store and rejects it in the other. If you run two storefronts, define the field once and mirror it verbatim.

The subtler trap is upstream. A metafield is only as true as the pipeline writing it, and when one missing component at ESF made 459 products look discontinued, every badge downstream was wrong too. The fix was not in the metafield layer. It was in never trusting a single feed read, the same discipline behind not overselling.

None of this is exotic. It is a custom field, written carefully, on the object it actually describes. The failures come from treating it like theme text instead of data.

Questions this answers

What is the difference between a product metafield and a variant metafield?

A product metafield applies to the whole product and shows the same value for every variant. A variant metafield attaches to one variant, so the king and queen versions of the same bed can carry different lead times or badge text.

How do I create a variant metafield in Shopify admin?

Go to Settings, Custom data, Variants, and add a definition with a namespace, key, and type. You can then set its value on each variant manually, which works for small catalogs but not for thousands of SKUs.

What does the metafieldsSet mutation do?

metafieldsSet creates or updates metafields on any owner object, product, variant, order, in a single GraphQL call. It accepts a batch of metafields and returns userErrors for any that fail validation.

How many metafields can I write per API call?

metafieldsSet accepts up to 25 metafields per call, each on its own owner. For a full catalog backfill, a bulk operation runs the writes asynchronously; for daily sync, diff first and only mutate the values that actually changed.

Why does the same metafield work on one store and fail on another?

The definition has to match on every store, including the type. A field defined as multi_line_text_field in one store and single_line_text_field in another will reject values that validate fine on the first.

How do stores show a Ships in 2-5 weeks badge?

The badge text lives in a variant metafield the theme reads when a shopper selects a variant. An automated sync writes it per variant, which is how different sizes of the same product can honestly show different lead times.

Your badges should never lie.

Delivery promises are only as good as the sync writing them. See how our inventory sync keeps per-variant lead times honest, or talk to us about your catalog.

New systems notes when we publish: