---
title: MetafieldReference - Storefront API
description: |
  The resource that a metafield points to when its type is a resource reference. Metafields can store references to other Shopify resources, and this union provides access to the actual referenced object.

  Returned by the `Metafield` object's [`reference`](/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.reference) field for single references or the [`references`](/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.references) field for lists.
api_version: 2026-04
source_url:
  html: https://shopify.dev/docs/api/storefront/latest/unions/metafieldreference
  md: https://shopify.dev/docs/api/storefront/latest/unions/metafieldreference.md
---

# Metafield​Reference

union

The resource that a metafield points to when its type is a resource reference. Metafields can store references to other Shopify resources, and this union provides access to the actual referenced object.

Returned by the `Metafield` object's [`reference`](https://shopify.dev/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.reference) field for single references or the [`references`](https://shopify.dev/docs/api/storefront/2026-04/objects/Metafield#field-Metafield.fields.references) field for lists.

## Fields with this union

* [Metafield.reference](https://shopify.dev/docs/api/storefront/latest/objects/Metafield#field-Metafield.fields.reference)

  OBJECT

  [Custom metadata](https://shopify.dev/docs/apps/build/metafields) attached to a Shopify resource such as a [`Product`](https://shopify.dev/docs/api/storefront/current/objects/Product), [`Collection`](https://shopify.dev/docs/api/storefront/current/objects/Collection), or [`Customer`](https://shopify.dev/docs/api/storefront/current/objects/Customer). Each metafield is identified by a namespace and key, and stores a value with an associated type.

  Values are always stored as strings, but the [`type`](https://shopify.dev/docs/api/storefront/current/objects/Metafield#field-Metafield.fields.type) field indicates how to interpret the data. When a metafield's type is a resource reference, use the [`reference`](https://shopify.dev/docs/api/storefront/current/objects/Metafield#field-Metafield.fields.reference) or [`references`](https://shopify.dev/docs/api/storefront/current/objects/Metafield#field-Metafield.fields.references) fields to retrieve the linked objects. Access metafields on any resource that implements the [`HasMetafields`](https://shopify.dev/docs/api/storefront/current/interfaces/HasMetafields) interface.

* [Metafield.references](https://shopify.dev/docs/api/storefront/latest/objects/Metafield#field-Metafield.fields.references)

  OBJECT

  [Custom metadata](https://shopify.dev/docs/apps/build/metafields) attached to a Shopify resource such as a [`Product`](https://shopify.dev/docs/api/storefront/current/objects/Product), [`Collection`](https://shopify.dev/docs/api/storefront/current/objects/Collection), or [`Customer`](https://shopify.dev/docs/api/storefront/current/objects/Customer). Each metafield is identified by a namespace and key, and stores a value with an associated type.

  Values are always stored as strings, but the [`type`](https://shopify.dev/docs/api/storefront/current/objects/Metafield#field-Metafield.fields.type) field indicates how to interpret the data. When a metafield's type is a resource reference, use the [`reference`](https://shopify.dev/docs/api/storefront/current/objects/Metafield#field-Metafield.fields.reference) or [`references`](https://shopify.dev/docs/api/storefront/current/objects/Metafield#field-Metafield.fields.references) fields to retrieve the linked objects. Access metafields on any resource that implements the [`HasMetafields`](https://shopify.dev/docs/api/storefront/current/interfaces/HasMetafields) interface.

* [Metafield​Reference​Connection.nodes](https://shopify.dev/docs/api/storefront/latest/connections/MetafieldReferenceConnection#returns-nodes)

  CONNECTION

  An auto-generated type for paginating through multiple MetafieldReferences.

* [Metafield​Reference​Edge.node](https://shopify.dev/docs/api/storefront/latest/objects/MetafieldReferenceEdge#field-MetafieldReferenceEdge.fields.node)

  OBJECT

  An auto-generated type which holds one MetafieldReference and a cursor during pagination.

* [Metaobject​Field.reference](https://shopify.dev/docs/api/storefront/latest/objects/MetaobjectField#field-MetaobjectField.fields.reference)

  OBJECT

  The value of a field within a [`Metaobject`](https://shopify.dev/docs/api/storefront/current/objects/Metaobject). For fields that reference other resources, use the [`reference`](https://shopify.dev/docs/api/storefront/current/objects/MetaobjectField#field-MetaobjectField.fields.reference) field for single references or [`references`](https://shopify.dev/docs/api/storefront/current/objects/MetaobjectField#field-MetaobjectField.fields.references) for lists.

* [Metaobject​Field.references](https://shopify.dev/docs/api/storefront/latest/objects/MetaobjectField#field-MetaobjectField.fields.references)

  OBJECT

  The value of a field within a [`Metaobject`](https://shopify.dev/docs/api/storefront/current/objects/Metaobject). For fields that reference other resources, use the [`reference`](https://shopify.dev/docs/api/storefront/current/objects/MetaobjectField#field-MetaobjectField.fields.reference) field for single references or [`references`](https://shopify.dev/docs/api/storefront/current/objects/MetaobjectField#field-MetaobjectField.fields.references) for lists.

***

```graphql
union MetafieldReference = Article | Collection | GenericFile | MediaImage | Metaobject | Model3d | Page | Product | ProductVariant | Video
```