Using Shopify metafields

How to create and manage metafields to display extra product information on Shopify

Metafields are Shopify's answer to custom attributes. They can be applied to different parts of your Shopify store, including products, customers, orders, and other objects. This article explains the various types of metafields, what information they can hold, and how to create them directly in a Plytix Shopify Channel.

Plytix is compatible with Metafields 2.0.

What are metafields?

Metafields let you add extra fields to your Shopify store beyond what's built in by default, so you can display product information Shopify doesn't have a native field for. For example, if you sell bicycles, you might want to show the number of speeds; if you sell food, you'll probably need to list the ingredients. Metafields don't have to be customer-facing either, some are used purely for internal purposes your team needs but customers never see.

In Plytix, you can create and manage these metafields directly from your Shopify Channel, so you're not setting them up manually in Shopify and then matching the data separately.

In short: metafields without a definition are simpler to set up but need Shopify Liquid code to display on your storefront. Metafields with a definition take a bit more setup, but if you're on a Shopify Online Store 2.0 theme, you can connect most of them directly through the theme editor, no coding required. If you're not sure which to use, definition-based metafields are the easier path for most storefronts.

 If you sell in multiple languages using Shopify Markets, several metafield types (Single Line Text, Multi Line Text, Rich Text, File Reference, and URL) can also be translated per language. Learn more in Managing Shopify Markets and Languages.

Types of metafields

Originally, Shopify offered three types of metafields, all supported by Plytix:

  • Integer
  • String
  • JSON String

These are what we refer to as metafields without a definition, and they're available only at the product level.

Metafields with a definition are available at both the product and variant level. Shopify has 20 different types of metafields with a definition (those in bold are currently supported by Plytix), grouped here by category:

  • Text & URLs: Single Line Text, Multi Line Text, Rich Text, URL
  • Numbers & Ratings: Integer, Decimal, Rating
  • Date & Time: Date, Date & Time
  • Measurements: Dimension, Weight, Volume
  • Color: Color
  • References: Product reference, Product variant reference, File reference, Page reference*
  • Other: True or False, JSON String, Money*

*May or may not be added in the future according to user needs.

 If you need a Money-type metafield, the workaround is to switch that metafield’s definition in Shopify to Decimal or Integer instead. Passing a value to an actual Money-type field from Plytix causes a type-mismatch error.

Plytix only supports product and variant metafields.

Metaobjects are a separate Shopify data structure from metafields and aren’t directly supported by the Plytix Shopify Channel. Whether this affects you depends on what the metaobject is used for: if it holds simple backend or display data (like values for a dropdown picker, or a bit of grouping logic), a supported metafield type can often represent the same data instead. Metaobjects with rich visual or interactive elements (like icon sets, sliders, or before/after widgets) generally can’t be represented this way.

Metafields without a definition

These metafields do the same basic thing as metafields with a definition, but they're less specific and require Shopify Liquid code to display them in your store.

Value Type Description Mapping Suggestions
Integer A whole number. Example: 200 Match with an Integer attribute.
String A piece of text. Example: Made with 100% eco-friendly materials. Match with a Dropdown, Multiselect, Boolean, or Plain text attribute.
JSON String A JSON-serializable value. This can be an object, an array, a string, a number, a boolean, or a null value. Example: {"name":"John", "age":30, "car":null} Match with a Plain text attribute.

To create a new metafield without a definition:

  1. Go to the Metafields tab of your Shopify Channel.
  2. Click Create metafield.

  1. Select No definition.
  2. Define the namespace and key.
  3. Choose the value type (Integer, String, or JSON string).
  4. Click Create metafield.

Your metafield is now available for mapping.

Use metafields to set custom meta titles and descriptions for your products, and improve how they show up in search. Learn how.

Metafields with a definition

This version of metafields doesn't require any coding on Shopify's end to customize your product pages, and is fully compatible with Shopify 2.0 themes. Create metafields in Plytix, then, if you have a Shopify Online Store 2.0 theme, connect most of them to your theme using the theme editor.

Text & URLs

Value Type Description Mapping Suggestions
Single Line Text A single line of text. Example: Made in the USA Match with a Plain text attribute.
Multi Line Text More than a single line of text. Example: In life, you can never have enough tote bags!... Match with a Plain text, Dropdown, HTML, or Multiselect attribute.
Rich text Supports specific formatting only: bold, italic, headlines, URL, and ordered or unordered lists. Can only be mapped to an HTML attribute.
URL A URL with one of the allowed schemes: https, http, mailto, sms, tel. Example: https://www.plytix.com/ Match with a URL attribute.

Numbers & Ratings

Value Type Description Mapping Suggestions
Integer A whole number. Example: 16 Match with an Integer attribute.
Decimal A number with a decimal point. Example: 25.99 Match with a Decimal attribute.
Rating A decimal value along a given scale, depending on how you configure your definition in Shopify. Example: 4.7 out of 5 stars Match with an Integer or Decimal attribute.

Date & Time

Value Type Description Mapping Suggestions
Date A date in ISO 8601 format without a presumed timezone. Example: 2022-03-21 Match with a date attribute.
Date and Time A date and time in ISO 8601 format without a presumed timezone. Example: 2017-08-01T12:15:00 Match with a date attribute.

Measurements

Value Type Description Mapping Suggestions
Dimension A whole number or decimal value with metric or imperial units of measurement. Example: 10 cm Match with an Integer or Decimal attribute, plus a Plain text attribute for the unit of measurement.
Weight A whole number or decimal value with metric or imperial units of measurement. Example: 3.5 lbs Match with an Integer or Decimal attribute, plus a Plain text attribute for the unit of measurement.
Volume A whole number or decimal value with metric or imperial units of measurement. Example: 750 ml Match with an Integer or Decimal attribute, plus a Plain text attribute for the unit of measurement.

Color

Value Type Description Mapping Suggestions
Color The hexadecimal code for a color. Example: #51227f Match with a Plain text or Dropdown attribute.

References

Value Type Description Mapping Suggestions
Product Reference Can reference single or parent products. Perfect for bundles, cross-sell, and complete-the-look experiences. Match with a Relationship from your PIM.
Variant Reference Can reference variant products. Perfect for bundles, cross-sell, and complete-the-look experiences. Match with a Relationship from your PIM.
File Reference Accepts any media or file type, including PDF, CSV, MP4, PNG, and more. Match with a Media Single, Media Gallery attribute, or Assets.

Reference metafields (Product and Variant) come with a few limitations, see Product and Variant Reference Metafields below for details.

Other

Value Type Description Mapping Suggestions
True or False A true or false value (use lowercase). Example: true Match with a Boolean attribute.
JSON String A JSON-serializable value. This can be an object, an array, a string, a number, a boolean, or a null value. Example: {"name":"John", "age":30, "car":null} Match with a Plain text or HTML attribute.

To create a new metafield with a definition:

  1. Go to the Metafields tab of your Shopify Channel.
  2. Click Create metafield.
  3. Definition is selected by default.
  4. Choose whether your metafield applies to the Product or Variant. Choosing Variant means the metafield won’t be displayed in the product detail in Shopify.
  5. Define the Namespace, Definition Name, and Key.
  6. Choose the type of information for this metafield from the Value Type dropdown.
  7. Optionally, enable Use in automated collection to connect this metafield to your automated collections in Shopify.
  8. Optionally, add a description for your metafield.
  9. Click Create Metafield.

The definition name is just a label to help you identify the metafield in Shopify’s admin. It doesn’t appear on your storefront.

 

Shopify allows merchants to create up to 256 metafield definitions per store, but you can create an unlimited number of metafields in Plytix. If you’re approaching that limit, one option is to consolidate several related attributes into a single JSON-type metafield instead of creating a separate definition for each one, for example, using a Formula attribute to combine multiple PIM attributes into one JSON value.

 If you want to match an attribute to a metafield that already exists in Shopify, make sure to use the same namespace as the existing metafield.

The namespace can’t be changed once it’s created.

Product and variant reference metafields

Product and Variant reference metafields let you create relationships between your products in Shopify, useful for upselling, cross-selling, or managing bundles.

To set one up in your Shopify Channel, select Product or Variant as the Value Type for your metafield.

It can be one value or a list of values. Once added, match it to one of your Plytix Relationships.

Good to know:

  • If you remove a product from your Plytix Relationship and sync again to Shopify, the metafield updates, but you need to make sure Erase the value and delete metafield from product (for products with no metafield value) is enabled in the Metafields settings of your Channel.
  • The order of your products in the Relationship in the PIM is reflected in your Shopify store after the Channel is processed.
  • You can’t create attribute transformations for product or variant reference metafields.
  • A Product reference metafield can only reference single or parent products from the Relationship. Variants with specified relationships are ignored when processing the Channel, use a Variant reference metafield for those instead.
  • A single metafield can’t mix product and variant references: if a Relationship mapped to a Variant reference metafield includes single products, those single products are dropped rather than included. If you need both product-level and variant-level references, map them to two separate metafields instead of one.
  • If a reference metafield points to a product that doesn’t exist in Shopify yet (for example, on a first-time sync where the related products are being created at the same time), the reference may not be set correctly, with no error shown, and reprocessing the Channel again won’t fix it on its own, since both products are now cached. If this happens, clear the cache for the affected products in the Settings tab and process the Channel again once all the referenced products already exist in Shopify.

 If a reference metafield isn’t mapped in your Channel, Plytix won’t touch it, so any curation you’ve done directly in Shopify (e.g. manually adjusting a bundle’s related products) persists. Once a metafield is mapped, though, Plytix’s value overwrites the Shopify-side value on every sync.

Metafield definitions

The term "definition" can be a little confusing, think of it as a template for creating a metafield. A metafield definition includes several main components:

  • Namespace: like a folder for keeping your metafields. You can use the same namespace and key for two metafields if one is a product and one is a variant. A namespace must be between 3 and 255 characters.
  • Key: the name you give your metafield. A key must be between 3 and 64 characters.
  • Description: optional, but can help clarify the purpose of the metafield.
  • Value Type: determines what type of information the metafield displays.
  • Validation Rule (not supported by Plytix): determines what information is valid for a metafield, for example, the number or type of characters it can contain. Different metafield types have different validations, set these up in your Shopify account directly.

Customers never see metafield namespaces and keys, they’re just a way of organizing your metafields.

Metafield values

To add values to a metafield, map your Plytix attributes to each one. Click Match Metafield in the Metafields tab of your Shopify Channel.

A panel appears offering options for matching a metafield to a Plytix attribute. Select an Existing attribute from the list...

...or click Apply an attribute transformation to create a Formula attribute that satisfies the metafield's validation rule, if needed.

If matching a metafield to a transformation attribute, you'll need one more step: add a formula using an operation to transform your stored attributes. After clicking Validate and Apply, the formula appears in the Formatting section of your metafield.

After matching all your metafields, click Save Changes at the top of your Channel. Process the Channel to push your new metafields through to Shopify.

Metafield lists

When you create a metafield with a definition, you can choose either a single value or a list of values. This option is only available for metafields with these supported value types:

  • Single line text
  • Integer
  • Decimal
  • References (Product, Variant, File, and Page)
  • File
  • Color
  • Rating
  • URL
  • Weight
  • Volume
  • Dimension
  • Date
  • Date and time

Some value types also require units of measurement, so you'll need to match additional attributes to unit lists for these:

  • Weight
  • Volume
  • Dimension

You can use up to 128 attributes in a metafield list. This is a limit set by Shopify.

To create a metafield list:

  1. Click Create metafield and give your new metafield a name. Leave Definition selected.
  2. Select whether the list is a Product or Variant metafield. Add a namespace, definition name, and key.
  3. Select a value type from the Value Type dropdown, then select List of values.
  4. Click Create Metafield.
  5. Select which attributes to add by clicking + Add attributes.
  6. Once selected, drag and drop to change their order. Click Apply when ready.
  7. Your metafield list now appears with your other metafields, distinguished by the LIS label at the start.
  8. Some lists also require units of measurement. To add these, click Match unit list.
  9. Click + Add attributes, select attributes for your units of measurement, then drag and drop to match the order of your previously matched attributes. Click Apply.
  10. Your completed metafield list appears with the attributes you matched (hover to see them), and your units of measurement (hover to see them), if applicable.

Frequently Asked Questions

Metafields without a definition are quicker to set up, but need Shopify Liquid code to display on your storefront. Metafields with a definition take more setup, but can usually be connected directly in the theme editor on a Shopify Online Store 2.0 theme, with no coding required.

Shopify allows up to 256 metafield definitions per store. If you’re getting close to that limit, combine related attributes into a single JSON-type metafield, rather than creating a separate definition for each one.

No. Attribute transformations aren’t supported for Product or Variant reference metafields.

The reference may not be set correctly, and no error is shown. Reprocessing the Channel on its own won’t fix it, since both products are already cached. Once all referenced products exist in Shopify, clear the cache for the affected products in Settings, then process the Channel again.

A Shopify metafield list can include up to 128 attributes, a limit set by Shopify.