---
title: Custom data
description: >-
  Store your app's data in Shopify with metafields and metaobjects, so you can
  query it, render it in themes, and use it across the platform.
source_url:
  html: 'https://shopify.dev/docs/apps/build/custom-data'
  md: 'https://shopify.dev/docs/apps/build/custom-data.md'
---

# Custom data

Most apps need to store data that Shopify's standard data model doesn't include, such as a fabric composition on a product, a warranty record, or a record type that only your app uses.

Custom data stores that information in Shopify, so you don't need to run your own database. The data behaves like the rest of the store's data: you can query it through the [GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql), render it in themes, read it from [Shopify Functions](https://shopify.dev/docs/apps/build/functions) and extensions, and let merchants edit it in the admin.

***

## Metafields or metaobjects

Choose based on whether your data describes an existing Shopify resource or stands on its own.

| | [Metafields](https://shopify.dev/docs/apps/build/metafields) | [Metaobjects](https://shopify.dev/docs/apps/build/metaobjects) |
| - | - | - |
| **What it is** | An extra field on an existing resource | A new record type that you define |
| **Use it when** | The data describes a product, order, customer, or other Shopify object | The data doesn't belong to an existing Shopify object |
| **Examples** | Care instructions on a product, a loyalty tier on a customer, a routing rule on an order | A size chart, a store location, an ingredient, a product review |

Most apps use both: a metaobject defines the record, and a metafield attaches it to the products it applies to. To learn how to combine them into one model, see [data modeling with metafields and metaobjects](https://shopify.dev/docs/apps/build/metaobjects/data-modeling-with-metafields-and-metaobjects).

***

## Create definitions first

Both metafields and metaobjects start with a *definition*: a name, a namespace, a type, and validation rules. A defined metafield gets a typed editor in the admin, validation on write, and support for search and filtering. An undefined metafield is stored as a plain string that merchants can't search or validate.

Your app owns its definitions through a [reserved namespace](https://shopify.dev/docs/apps/build/metafields/definitions), so a merchant's own custom data and another app's data can't collide with yours. Start with [managing metafield definitions](https://shopify.dev/docs/apps/build/metafields/definitions) or [metaobject definitions](https://shopify.dev/docs/apps/build/metaobjects/manage-metaobject-definitions), and check the [list of data types](https://shopify.dev/docs/apps/build/metafields/list-of-data-types) for the validation options that each type supports.

***

## Where custom data is available

After you store custom data in Shopify, it's available across the platform:

* **Shopify admin**: Merchants edit the data in a typed editor, if you make the definition visible to them.
* **Themes**: Storefronts render the data through Liquid and the [Storefront API](https://shopify.dev/docs/api/storefront).
* **Shopify Functions**: Discount and delivery logic reads the data through [input queries](https://shopify.dev/docs/apps/build/functions/input-queries/metafields-for-input-queries).
* **Checkout and admin extensions**: Your extension UI reads the same values as everything else.
* **Shopify Analytics**: Merchants group and chart on the data, if you mark a definition [analytics-queryable](https://shopify.dev/docs/apps/build/metafields/use-metafield-capabilities#analytics-queryable).

***

## Next steps

* Start with [metafields](https://shopify.dev/docs/apps/build/metafields) if you're extending something Shopify already has.
* Start with [metaobjects](https://shopify.dev/docs/apps/build/metaobjects) if you're modeling something new.
* Check the [metafield limits](https://shopify.dev/docs/apps/build/metafields/metafield-limits) and [metaobject limits](https://shopify.dev/docs/apps/build/metaobjects/metaobject-limits) before you design around a large data set.

***
