Metafield representation object
Last updated
Was this helpful?
Last updated
Was this helpful?
Important Notice
Shopify is deprecating the Shopify Admin REST API which the Mechanic REST objects depend on. The first round of deprecations involve the product and variant endpoints. Read about the deprecation and . Use the going forward. The and objects will cease to work on on Feb 1, 2025 due to the changes being made by Shopify. Shopify will phase out the REST API completely over time, you can read more about this .
All of our will be ported to use GraphQL only, which will provide a model for how you can update your custom tasks. You'll be able to update your non-customized library tasks with a click of a button Please see these for migrating your custom tasks to GraphQL.
Mechanic's metafield representation object mirrors , in that it makes the metafield type and value easily available, in a usable form. It is not the same as Mechanic's , which contains the REST Admin API representation of a metafield.
Metafield representation objects are only available for modern metafield types. They are not available for (i.e. json_string, number, and string).
A metafield representation object always contains these three properties:
type
β the type of the metafield (see )
value
β the parsed, appropriately-typed value of the metafield
metafield
β the source , useful for retrieving the metafield ID
For reference types that map to a REST API resource (e.g. page_reference, product_reference, and variant_reference), a metafield representation object also contains a property named after the resource in question.
For example, a product_reference metafield representation object contains a product
property, which holds the associated . This means that the referenced product may be retrieved using resource.metafields.namespace.key.product
.
A metafield representation object can only be retrieved via lookup: resource.metafields.namespace.key
.