The metafield object
Metafields make it possible to store additional information for articles, blogs, collections, customers, orders, pages, products, the shop, and variants. You can access the
metafield object through the
metafields attribute of these resources.
Metafields support multiple data types, which determine the kind of information that's stored in the
metafield object. You can also apply Liquid metafield filters to this object in order to output metafield information in a standard format.
metafield object has the following attributes:
Returns the metafield type.
Returns the metafield value.
The following outlines the value format for each metafield type:
||A product object|
||A variant object|
||A page object|
||A generic_file object|
||A date object|
||A url string|
||A color object|
||A measurement object|
The access path for metafields consists of two layers:
namespace- A grouping of metafields to prevent conflicts.
key- The metafield name.
Given this, you can access the
metafield object with the following syntax:
For example, you might have the following metafield added to a product:
Using this metafield information, the following input generates the following output: