metafield
附加到特定资源(如商品、订单等)的元字段。
有关如何访问资源上的元字段,可参考 get_metafield 和 get_metafields。
元字段支持多种数据类型。若要以特定格式渲染或输出元字段,可以使用 metafield_text filter 和 metafield_tag tag。
属性
元字段的值是否为列表。
true:元字段的值是列表。false:元字段的值不是列表。
元字段的类型。
| 可选值 | 描述 |
|---|---|
| single_line_text_field | 单行文本 |
| multi_line_text_field | 多行文本 |
| rich_text_field | 富文本 |
| product_reference | 商品 |
| collection_reference | 商品分类 |
| variant_reference | 商品款式 |
| page_reference | 页面 |
| article_reference | 博客文章 |
| file_reference | 文件 |
| number_integer | 整数 |
| number_decimal | 小数 |
| date | 日期 |
| date_time | 日期和时间 |
| url | URL |
| link | 链接 |
| json | JSON |
| boolean | 布尔值 |
| color | 颜色 |
| weight | 重量 |
| volume | 体积 |
| dimension | 尺寸 |
| rating | 评分 |
| money | 金额 |
| metaobject | 元对象 |
元字段的值。
下表列出了各元字段类型的值所支持的格式:
| 类型 | 返回值格式 |
|---|---|
| 字符串 |
| 富文本(支持标题、列表、粗体、斜体和链接格式) |
| product 对象 |
| collection 对象 |
| variant 对象 |
| page 对象 |
| article 对象 |
| 以下其中之一: |
| 数字 |
| 日期字符串(可使用 date filter 进行格式化) |
| URL 字符串 |
| 链接对象 |
| JSON 对象 |
| 布尔值 |
| color 对象 |
| 测量对象 |
| 评分对象 |
| 货币金额对象 |
| metaobject 对象 |
这篇文章对你有帮助吗?
SHOPLINE