shopify店铺如何添加Metafields?

什么是Metafields?

Metafields,我们也称为元数据,是可以扩展Shopify字段的一种数据,比如扩展产品/分类/顾客/博客等信息,这种数据是存储在Shopify的服务器中,与其他原始数据一同存储,并无其他不同。

shopify店铺如何添加Metafields?

如果是懂技术开发的人,可以自己通过API的形式添加元数据,具体参考API文档。如果我们只是普通shopify卖家,我们可以通过API来实现Metafields的增删改查。在shopify的App市场中搜索Metafields,会出来很多编辑Metafields的App。关于Metafields App,我们需要知道的几点:

1.该App用免费的即可,不需要用付费,比如Metafields Guru。

2.后台数据编辑App,不会影响到我们店铺的前端网站速度。

3.后期如果App被删除,原本存储的数据不会一起丢失,仍然存在,可继续使用。

添加Metafiels时,我们通常会添加三个信息,分别是Namespaces / Key / Value。Namespaces也叫命名空间,用来对不同的元数据进行发呢类,Key指用于引用我们信息,Value包含我们的唯一内容。Value值我们通常可以选择字段类型,比如字符串或者是数值等。

如何使用Metafields?

一般大多数Metafields编辑器只用来对元数据做增删改查,却不能直接通过App将这些信息展示出来,只能我们自己敲一两行代码解决。非常简单,信息的读取如下: {{ product.metafields.Namespaces.Key }}。product指产品元数据,若是添加到Collection,那这里可以填写collection,另外还有比如vairant / order等。

Metafields can be added to the following resources:

Type of resource Location of metafields
Article /admin/blogs/#{id}/articles/#{id}/metafields.json
Blog /admin/blogs/#{id}/metafields.json
CustomCollection and SmartCollection /admin/collections/#{id}/metafields.json
Customer /admin/customers/#{id}/metafields.json
Draft Order /admin/draft_orders/#{id}/metafields.json
Order /admin/orders/#{id}/metafields.json
Page /admin/pages/#{id}/metafields.json
Product /admin/products/#{id}/metafields.json
Product Variant /admin/products/#{id}/variants/#{id}/metafields.json
Product Image /admin/metafields.json?metafield[owner_id]=#{id}&metafield[owner_resource]=product_image

This endpoint will let you view the metafields for a product image. To add or change product image metafields, use the product image endpoint.

Shop /admin/metafields.json

 

Metafield properties

created_at
read-only
"created_at": "2012-03-13T16:09:54-04:00"

The date and time (ISO 8601 format) when the metafield was created.

updated_at
read-only
"updated_at": "2012-08-24T14:02:15-04:00"

The date and time (ISO 8601 format) when the metafield was last updated.

description
"description": null

A description of the information that the metafield contains.

id
read-only
"id": 915396206

The unique ID of the metafield.

key
required
"key": "warehouse"

The name of the metafield. Maximum length: 30 characters.

namespace
required
"namespace": "inventory"

A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. Maximum length: 20 characters.

owner_id
"owner_id": 690933842

The unique ID of the resource that the metafield is attached to.

owner_resource
"owner_resource": "product"

The type of resource that the metafield is attached to.

value
required
"value": 25

The information to be stored as metadata. Maximum length: 512 characters when metafield namespace is equal to tags and key is equal to alt.

value_type
required
"value_type": "integer"

The metafield’s information type. Valid values: string, integer, json_string.

发表评论

电子邮件地址不会被公开。 必填项已用*标注