Shopify Metafields: Why Your Value Renders as Escaped JSON
You added a metafield, output it in Liquid, and got a wall of quotes and brackets. Here is what metafield_tag does and when you still need the raw value.
| Type | .value returns |
Use |
|---|---|---|
single_line_text_field |
String | .value |
multi_line_text_field |
String with newlines | .value \| newline_to_br |
rich_text_field |
Nested object | metafield_tag |
number_integer |
Integer | .value |
boolean |
true or false | .value in a condition |
date |
Date string | .value \| date: "%d %b %Y" |
file_reference |
File object | metafield_tag or .value \| image_url |
product_reference |
Product object | .value.title, .value.url |
list.single_line_text_field |
Array | iterate |
json |
Parsed object | access properties directly |
dimension |
Object with value and unit | .value.value and .value.unit |
Published on debugly.dev by Rohit Bhadani | Founder of Krova Cloud