Creating custom metafield definitions

If there's no standard metafield definition for the specialized information that you want to add to your Shopify store, then you can create a custom metafield definition. You also create custom definitions when you migrate existing metafields to a definition.

When you create a custom definition for a metafield, you specify the following information:

  • namespace and key, for example, to group metafields for specific parts of your store
  • content type, such as text, file, or URL
  • validation rules, such as character limits, or minimum and maximum values
  • description (optional), such as information about what values to enter for the metafield

Learn more about parts of a metafield definition.

Some content types have additional configuration options that you need to select. Configuration options can include the following:

  • default units of measurement
  • single-line or multi-line fields
  • minimum and maximum values
  • default currency

Create a custom definition

  1. From your Shopify admin, go to Settings > Metafields.
  2. In the Manage metafields section, select the type of metafield that you want to add. For example, Product metafields.
  3. Click Add metafield definition.
  4. In the Name field, enter a name for your definition, and then select the name that you entered from the dropdown menu.
  5. Optional: In the Namespace and key field, edit the default identifier for your metafield.
  6. Optional: In the Description field, enter a description for your metafield values.
  7. Click Select content type, and then select the content type that best matches your metafield from the dropdown menu.
  8. Configure the content type and validation information:
    • If the content type has additional configuration options, then select the correct option for your metafield. For example, type of measurement.
    • Optional: In the Validation section, configure the Additional rules to limit the range of accepted values.
    • If the content type has a Defaults section, then select a default unit from the dropdown menu.
    • Optional: If you want to change the content type or validation rules for your custom definition, click Change, and then select another content type from the dropdown menu.
  9. Click Save.

Next steps

After you add definitions for your metafields, you can do the following:

Ready to start selling with Shopify?

Try it free