# Metafield collection 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 %}

A metafield collection object is an iterable set of metafields, which also supports using lookups to narrow the set by metafield namespace, or, further, to identify a single metafield by looking up by key.

## How to access it

* Use `resource.metafields` to retrieve the full set of that resource's metafields
* Use `resource.metafields.namespace` to retrieve the full set of that resource's metafields, filtering by metafield namespace
* Use `resource.metafields.namespace.key` to retrieve a [metafield representation object](/platform/liquid/objects/shopify/metafields/metafield-representation-object.md) – *unless* the referenced metafield has a [deprecated type](https://shopify.dev/api/liquid/objects/metafield#deprecated-metafields), in which case the parsed metafield value is returned directly

### Supported Liquid resources

* Article
* Blog
* Collection
* Customer
* Order
* Page
* Product
* Shop
* Variant


---

# 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-collection.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.
