Metafield Value Type has been depreciated in Shopify and replaced with a new field called Type. This change originated from Shopify and we are supporting this change. The original Value Type field of string, integer, json_string, boolean are still supported by Shopify for now but new values are now possible. We continue to use the value_type as column names in our import and export file format. Consider value_type and type the same in our apps.
The new field Type supports additional data types such as page reference, product reference, date, date time etc. See the reference below on how to use the new data types.
Existing metafields will still work as is. The old Value Type of string are now expanded to support additional type like single_line_text_field, multi_line_text_field. multi_line_text_field is for text that has line breaks in them.
Name | API name (use in Import/Export) | Description | Example | Value type (deprecated) equivalent |
---|---|---|---|---|
Single line text | single_line_text_field |
A single-line text field. | This is a short text |
string |
Multi-line text | multi_line_text_field |
A multi-line text field. |
Dinner |
string |
Page reference | page_reference |
A reference to a page on the online store. | gid://shopify/OnlineStorePage/1 |
string |
Product reference | product_reference |
A reference to a product on the online store. | gid://shopify/Product/1 |
string |
Variant reference | variant_reference |
A reference to a product variant on the online store. | gid://shopify/ProductVariant/1 |
string |
File reference | file_reference |
A reference to a file on the online store. | gid://shopify/MediaImage/123 |
string |
Integer | number_integer |
A whole number in the range of +/-9,007,199,254,740,991. | 110 |
integer |
Decimal | number_decimal |
A number with decimal places in the range of +/-9999999999999.999999999. | 10.14 |
string |
Date | date |
A date in ISO 8601 format without a presumed timezone. | 2022-02-02 |
string |
Date and time | date_time |
A date and time in ISO 8601 format without a presumed timezone. | 2021-12-01T12:30:00 |
string |
URL | url |
A URL with one of the allowed schemes: https , http , mailto , sms , tel . |
https://www.shopify.com |
string |
JSON string | json |
A JSON-formatted string. Note: The json_string type is deprecated but does still exist because it behaves differently than the new json type in Liquid. |
[{ "k": "v1" }, { "k": "v2" }] |
json_string |
Boolean | boolean |
A true or false value. | true |
boolean |
Color | color |
The hexadecimal code for a color. | #fff123 |
string |
Weight | weight |
A value and a unit of weight. Valid unit values: oz , lb , g , kg |
{ "unit": "kg", "value": 2.5 } |
json_string |
Volume | volume |
A value and a unit of volume. Valid unit values: ml , cl , l , m3 (cubic meters), us_fl_oz , us_pt , us_qt , us_gal , imp_fl_oz , imp_pt , imp_qt , imp_gal . |
{ "unit": "ml", "value": 20.0 } |
json_string |
Dimension | dimension |
A value and a unit of length. Valid unit values: in , ft , yd , mm , cm , m |
{ "unit": "cm", "value": 25.0 } |
json_string |
Rating | rating |
A rating measured on a specified scale | { "value": "3.5", "scale_min": "1.0", "scale_max": "5.0" } |
json_string |
You would currently access the metafield value in liquid syntax like this product.metafields.namespace.key
New syntax to access the value is
product.metafields.namespace.key.value but the old syntax will continue to work. But Shopify advises you to switch to the new syntax to show value.
Comments
0 comments
Article is closed for comments.