Metafield to Liquid Snippet Generator
Pick a Shopify metafield's type and owner resource and get the exact correct Liquid to read it — every type accesses its value differently.
Quick picks
Not every type can be stored as a list \u2014 this only affects the generated Liquid, check your metafield definition in Shopify admin for what's actually available.
How it works
- 1
Pick an owner resource
Choose Product, Variant, Collection, Page, Blog, Article, Shop, Customer, or Order, this sets the correct Liquid root object.
- 2
Choose the metafield type
Select the exact type your metafield was created as in Shopify admin, each one accesses its value differently.
- 3
Enter the namespace and key
Match these exactly to how the metafield is defined, they default to custom and my_field as placeholders.
- 4
Toggle list if needed
Check "This is a list metafield" if it stores multiple values, the output wraps the same access pattern in a loop.
- 5
Copy the generated Liquid
Copy the code and paste it directly into your section or template, adjusting field names for JSON or metaobject types as needed.
About the Metafield to Liquid Snippet Generator
Shopify has around 25 metafield types, and nearly every one of them needs genuinely different Liquid to read correctly: a plain text field prints directly, a rich text field needs the metafield_tag filter, a money field needs | money, a reference field returns a full object you have to dig into, and a list of any of those needs a loop on top. Guessing wrong is a very common source of a metafield that shows nothing, or shows raw JSON, on an otherwise correctly configured page. This tool removes the guessing: pick the owner resource, namespace, key, and type, and get back working, correct Liquid immediately.
Why the same {{ }} syntax doesn't work for every type
A metafield object in Liquid isn't just its value, it's a wrapper with its own .value property, and what that value actually contains depends entirely on the metafield's type. A single line text field's value is a plain string, but a money field's value is a JSON object with amount and currency_code, a rating's value is an object with value, scale_min, and scale_max, and a product reference's value is an entire product object with its own nested properties. Printing {{ metafield.value }} blindly works for some types and produces something unreadable for others, which is exactly the confusion this tool is built to remove.
Reference types return whole objects, not values
Product, variant, collection, page, file, and metaobject reference types are the ones people get stuck on most, since .value for these doesn't return a simple value at all, it returns the entire referenced object. A product reference's .value is a real product, with .title, .url, .featured_image, everything a normal product object has. A file reference's .value could be an image, a video, or a generic file, each needing different handling, which is why the generated snippet for file references includes a type check rather than assuming one media type.
List metafields need a loop, not just a different filter
Checking "This is a list metafield" wraps the same per-type access logic inside a {% for %} loop instead of accessing .value once directly, since a list metafield's value is an array of whatever the base type's value normally looks like, an array of strings, an array of product objects, an array of money-shaped objects. The loop body reuses the exact same access pattern as the single version, just applied to each item, which is the detail most likely to get missed when adapting single-value Liquid to a list by hand.
Where this tool hedges on purpose
Rich text lists, mixed references, and metaobject references sit in genuinely less standardized territory, rich text specifically doesn't handle well per-item inside a list loop the way most other types do, mixed references resolve to different object shapes depending on what was actually selected, and metaobject references depend entirely on field keys unique to your own metaobject definition. This tool flags those cases with an explicit caveat rather than presenting a guess as a certainty, and asks for your actual field key directly for metaobject references instead of assuming one.
Works for any owner resource, not just products
Metafields aren't just for products, collections, pages, blogs, articles, the shop itself, customers, and orders can all carry their own metafields, and each one is accessed through a different root object in Liquid. Switching the owner resource updates the generated prefix accordingly, product.metafields..., collection.metafields..., shop.metafields..., and so on, including the specific syntax variant needed to reach the currently selected variant through a product object.
Runs entirely in your browser
The Liquid is generated instantly from static logic in your browser, nothing you configure is sent to a server. Once you have the right access pattern, our Liquid Playground is a good next step for testing it against realistic mock data, and our Section Schema Builder helps if the metafield needs a matching section setting, both part of the same Shopify Tools collection this tool belongs to.
Frequently asked questions
Why does {{ product.metafields.custom.my_field }} sometimes show nothing?
For most types you need .value to reach the actual stored value, and for rich text specifically you need the metafield_tag filter instead. Printing the metafield object directly doesn't reliably work across every type.
What does a reference type's .value actually contain?
The entire referenced object, not just an ID or a name. A product reference's .value is a full product with all its normal properties, a file reference's .value is an image, video, or generic file object depending on what was uploaded.
How do I access a list metafield's individual items?
Loop over its .value with a for loop, each item in the loop has the same shape as the type's single value would, a string, a money-shaped object, a full reference object, and so on.
Why does this tool ask for a metaobject field key?
Metaobjects use their own field system rather than metafields, so there's no universal property name to guess, the field key has to match whatever was actually defined on that specific metaobject.
Is the generated Liquid guaranteed to be correct for every case?
It's correct for the standard, well-documented access pattern for each type. Rich text lists, mixed references, and metaobject references are flagged with a caveat since their exact behavior can depend on specifics this tool can't know in advance.
Does this work for metafields on any resource, or just products?
Any of the nine standard owner resources, product, variant, collection, page, blog, article, shop, customer, and order, each uses a different root Liquid object, which this tool accounts for.
What does the money type's stored value look like?
A JSON object with amount and currency_code, the money filter reads that shape directly, which is why the generated snippet pipes .value straight into | money rather than trying to format it manually.
Is my configuration sent anywhere?
No, the Liquid is generated entirely in your browser from static logic. Nothing you select or type is sent to a server.