Skip to main content
Glama
metafield.md1.88 kB
# Liquid Metafield Object Documentation ## Overview A metafield is a custom data field attached to parent objects in Shopify's Liquid template language. Metafields cannot be created within Liquid itself—they must be created through the Shopify admin or via an app. ## Key Properties ### list? Returns `true` if the metafield is a list type; `false` otherwise. ### type Specifies the metafield's data type. Supported types include: - Text fields: `single_line_text_field`, `multi_line_text_field`, `rich_text_field` - Reference types: `product_reference`, `collection_reference`, `variant_reference`, `page_reference`, `file_reference` - Numeric types: `number_integer`, `number_decimal` - Date/time: `date`, `date_time` - Other types: `url_reference`, `json`, `boolean`, `color`, `weight`, `volume`, `dimension`, `rating`, `money` ### value Contains the actual metafield data. The format depends on the metafield type: - Text types return strings - Reference types return corresponding objects (product, collection, etc.) - Numeric types return numbers - JSON types return objects with accessible properties - List types return arrays ## Accessing Metafields Use the syntax: `{{ resource.metafields.namespace.key }}` Example: `{{ product.metafields.information.directions.value }}` ## Working with JSON Metafields Access properties directly by name or index: ``` {{ product.metafields.info.data.value.temperature }} {{ product.metafields.info.data.value['unit'] }} ``` ## Working with List Metafields Iterate through arrays: ``` {% for item in product.metafields.info.list.value %} {{ item }} {% endfor %} ``` Determine list length using `count` (reference types) or `size` filter (non-reference types). ## Deprecated Types Older metafield types (`integer`, `json_string`, `string`) return values directly without object properties and lack filter compatibility.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/florinel-chis/shopify-liquid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server