Each metafield has a type, which defines the type of information that it can store. The metafield types have built-in validation and Liquid support.

How it works

For metafield definitions, the type is enforced across every instance of the resource that owns the metafield definition. For example, if you create a metafield definition called "shipping" with the type multi_line_text_field with an owner type of PRODUCT, then the metafield's type will be multi_line_text_field for every product resource.

  "product": {
    "metafields": {
      "namespace": "custom",
      "key": "shipping",
      "type": "multi_line_text_field",
      "value": "All health potions are made to order, so it might take up to 2 weeks before your order can be shipped.\n\nThanks for your patience!"

Supported types

Metafields can have any of the types included in the tables below:

Type Description Example value Value type
boolean A true or false value. true boolean
color The hexadecimal code for a color. #FFA500 string
date A date in ISO 8601 format without a presumed timezone. 2030-12-31 string
date_time Date and time in ISO 8601 format without a presumed timezone. 2023-07-31 12:20:20 string
dimension A value and a unit of length. Valid unit values: mm, cm, m, in, ft, yd. {
    "unit": "MILLIMETERS",
    "value": 98.2
JSON object
json A JSON-serializable value. This can be an object, an array, a string, a number, a boolean, or a null value. {
    "temperature": 700,
    "unit": "degrees",
    "scale": "Fahrenheit"
JSON object
multi_line_text_field A multi-line text field. All health potions are made to order, so it might take up to 2 weeks before your order can be shipped.

Thanks for your patience!
number_decimal A number with decimal. 8.4 number
number_integer A integer number. 3 number
rating A rating measured on a specified scale. {
    "scale_max": "10.0",
    "scale_min": "0.0",
    "value": 4.5
JSON object
single_line_text_field A single-line text field. Take with a meal. string
url A URL with one of the allowed schemes: https, http. https://www.shoplazza.com/ string
volume A value and a unit of volume. Valid unit values: ml, cl, L, m3, fl oz, pt, qt, gal, imp fl oz, imp pt, imp qt, imp gal. {
    "unit": "MILLILITERS",
    "value": 250
JSON object
weight A value and a unit of weight. Valid unit values: kg, g, lb, oz {
    "unit": "GRAMS",
    "value": 50
JSON object

Reference types

Reference metafields enable you to store references to Shoplazza resources.

TypeDescriptionExample valueType
collection_referenceA reference to a collection on the online store.collection objectJSON object
file_referenceA reference to a file on the online store. The default value is Image.{
"mediaContentType": "IMAGE",
"image": image object
JSON object
product_referenceA reference to a product on the online store.product objectJSON object