Metafield content types and values
Each type of metafield accepts a range of supported values for different use cases. Refer to the table of common metafield content types for information about the following:
- supported values for each type of metafield
- example use cases for each type of metafield
- if the content type can be used as ametafield list
For more information, refer tothe developer documentation for Metafields.
Content type | Description | Type can be used in a list | Example |
---|---|---|---|
Date | Supports date values in ISO 8601 format, without a time zone. | Yes | 添加product expiration dates, order delivery dates, or customer birth dates. |
Date and time | Supports date values in ISO 8601 format and time values in UTC time. | Yes | 添加launch event dates or product release dates. |
Weight | Supports both whole number and decimal values. Weight uses either metric or imperial units of measurement. | Yes | 添加the weight of a product or ingredient, for example, grams of sugar. |
Volume | Supports both whole number and decimal values. Volume uses either metric or imperial units of measurement. | Yes | 添加the volume capacity of a water bottle. |
Dimension | Supports both whole number and decimal values. Dimension uses either metric or imperial units of measurement. | Yes | 添加box heights or product lengths, such as the length of a scarf. |
Integer | Integer values can be in the range of -4,611,686,018,427,387,904 to 4,611,686,018,427,387,903. | Yes | 添加a page count for books. |
Decimal | Decimal values can be in the range of +/-9999999999999.999999999, with up to 13 digits before the decimal and up to 9 digits after. | Yes | 添加a carat weight for jewelry. |
File reference | Supportsuploadinga single file in one of the following file types:
Refer toFile format requirementsfor supported file types. |
Yes | 添加a PDF file for assembly instructions. |
Page reference | Allows you to link to an existing page. Supports linking to a single or multiple pages in a metafield list. | Yes | Insert your policy page or a detailed care guide on products in your online store. |
Product reference | Supports linking to a single or multiple products in a metafield list. | Yes | Store and display featured products on product pages or collection pages in your online store. |
产品变体参考 | Supports linking to a single product variant. | Yes | Store and display other clothing items in the same color on product pages in your online store. |
Metaobject reference | Supports linking to a single or multiple metaobject entries. | Yes | 添加and display a custom influencer profile on select product pages. |
收集参考 | Allows you to link to an existing collection. Supports linking to a single or multiple collections in a metafield list. | Yes | Include a "Complete the look" collection for fashion products in your online store. |
Single line text | Supports plain text with no line breaks. 你可以限制总统单行的字段et choices that you specify when you create your metafield definition. |
Yes | 添加short notes and announcements. |
Multi-line text | Supports plain text with line breaks. You can choose your minimum and maximum lengths and regular expression rules. |
No | 添加shipping notes or return policies. |
Rich text | Supports text with line breaks and inline styling, including heading styles, bold, italic, and underline. Can only be connected to theme settings of type rich text. Themes handle styling in different ways, which might override the styles you apply here. Check with your theme’s documentation to better understand how the Rich text metafield will be styled in your theme. |
No | 添加long-form stories about your brand or product, including styling. |
Color | Supports RGB values in#RRGGBB format. |
Yes | Store the color of a product and then set the background of the product page to the same color. |
Money | Supports both whole number and decimal values. Currency code must match store currency. | No | Track product cost details, such as distributor cost or ship to warehouse cost. |
Rating | Supports decimal values along a given scale, depending on how you configure your definition. | Yes | 添加an audience score or a star rating for a product. |
True or false | Creates a checkbox for selecting whether a condition is true or false. | No | 添加whether an option is available, such as whether an item can be engraved. |
URL | SupportsHTTP ,HTTPS andmailto: URLs. You can limit URLs to specific domains when you create your metafield definition. |
Yes | 添加a link to book reviews or product videos that are hosted on a specific website. |
JSON | Supports raw JSON data for advanced use cases when you need a structured data source. | No | 添加a table of specifications that has different columns for each product, for example, tables of ingredients. |
Mixed reference | Supports references of any type. Developer support is needed to use this type in your storefront.Learn more about custom data for developers. |
Yes | Create dynamic landing pages in your Hydrogen Storefront. |