Metafield definitions enable you to include data validation for metafields, and enable merchants to add metafield values for resources in the Shopify admin.
We also provide standard metafield definitions for common use cases. Using standard definitions means that your app can access information that merchants might have already stored in these metafields and provides interoperability across the Shopify platform. Learn about the standard metafield definitions we offer.
How it worksAnchor link to section titled "How it works"
A metafield definition includes the following information:
- Namespace: A container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with other metafields with the same key name.
- Key: The name for the metafield.
Type: The type of data that the metafield stores.
Name: A human-readable name for the metafield definition. The name is displayed to merchants in the Shopify admin.
Description (optional): A description of the metafield definition. The description is displayed to merchants in the Shopify admin.
Owner type: The resource that the metafield is attached to.
Validation options (optional): An array of validation options for the metafield value. For example, for a metafield with the type
date, you can set a minimum date validation, so that the metafield can store only dates after a specific date.