# Metafield representation object

{% hint style="warning" %}
These Shopify REST-backed Liquid objects are legacy. The product and variant Liquid objects no longer work, and Shopify is phasing out the REST Admin API that these objects depend on. Use [GraphQL](/core/actions/shopify.md#graphql) for new work; see the [Shopify REST Admin API notice](/platform/liquid/objects/shopify.md) and [migration guides](/resources/converting-tasks-from-shopify-rest-to-graphql.md).
{% endhint %}

{% hint style="info" %}
This page is part of a series: see [Metafields](/platform/liquid/objects/shopify/metafields.md) for an overview on how Mechanic's Liquid implementation thinks about metafields.
{% endhint %}

Mechanic's metafield representation object mirrors [Shopify's metafield Liquid object](https://shopify.dev/api/liquid/objects/metafield), in that it makes the metafield type and value easily available, in a usable form. It is not the same as Mechanic's [metafield object](/platform/liquid/objects/shopify/metafields/metafield-object.md), which contains the REST Admin API representation of a metafield.

{% hint style="warning" %}
Metafield representation objects are only available for modern metafield types. They are not available for [deprecated metafields](https://shopify.dev/api/liquid/objects/metafield#deprecated-metafields) (i.e. json\_string, number, and string).
{% endhint %}

## What it contains

A metafield representation object always contains these three properties:

* `type` — the type of the metafield (see [Shopify's reference list](https://shopify.dev/apps/metafields/definitions/types))
* `value` — the parsed, appropriately-typed value of the metafield
* `metafield` — the source [metafield object](/platform/liquid/objects/shopify/metafields/metafield-object.md), useful for retrieving the metafield ID

### Resource references

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 [product object](/platform/liquid/objects/shopify/product.md). This means that the referenced product may be retrieved using `resource.metafields.namespace.key.product`.

## How to access it

A metafield representation object can only be retrieved via [metafield collection](/platform/liquid/objects/shopify/metafields/metafield-collection.md) lookup: `resource.metafields.namespace.key`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.mechanic.dev/platform/liquid/objects/shopify/metafields/metafield-representation-object.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
