Collections with metafields

Collections can have selection conditions to automatically include matching products or variants. A single collection can have a maximum of 60 total conditions, and you can specify if products or variants need to meet all conditions or any condition to be included in the collection. You can use metafield data as part of the conditions to give you more specific control of your collections.

Complete the following actions before you create a collection condition using metafields:

Benefits of using metafield data in collection conditions

Collection conditions with metafields can help you create more precise automated collections, when you need to use structured product or variant information. In comparison, tags assigned directly to products are useful when you need a simple label or grouping method. For example, you might use tags such as sale, fragile, or vip to group products for internal filtering or broad segmentation.

Metafields are useful when you need to store a specific attribute and value in a consistent format. For example, you might create a product metafield for material with the value cotton, or a variant metafield for fabric with the value linen. You can then use those metafields as automated collection conditions, such as including products that have at least one variant where the fabric is linen.

Because metafields are part of your data model, you can integrate this same data across Shopify, such as your online store. You can use metafields to be more specific in your collections. You can create metafield definitions for color, and then create a collection that only pulls in products that have the color value you want for the collection. You can create a metafield definition that is for fulfillment urgency, and then create a collection that only pulls in products that are marked with an urgent fulfillment value. Metafields provide more flexibility and structure than tags.

Considerations for using metafield data in collection conditions

Before using metafields to define conditions for collections, review the following considerations:

  • The activate collections setting has a maximum of 128 definitions per product metafield definitions and variant metafield definitions.
  • You can't delete a metafield definition until the collection is updated to remove the metafield definition as a condition.
  • When using a metafield as a condition for including variants in a collection, the metafield must be connected to a linked variant option in order for the customer-facing collection filters and swatches to filter down to only the included variants.

Metafield definitions and supported conditions

Only certain product and variant metafield definitions are supported with specific conditions.

Metafield definitions and supported conditions for collections
Metafield definition typeSupported conditions
True or falseequals
Integerequals
greater than
less than
Decimalequals
greater than
less than
Ratingequals
greater than
less than
Single line text (one value and list of values)equals

Activating the collections setting

To use a metafield definition for collections, you need to activate the setting in your metafield definitions. Learn more about creating custom metafield definitions.

Steps:

Desktop
  1. From your Shopify admin, go to Settings > Metafields and metaobjects.

  2. Depending on the metafield definition that you want to use for collections, select either Products or Variants.

  3. Click the metafield definition that you want to use for your collection.

  4. In the Options section, select Collections.

  5. Click Save.

Mobile
  1. From the Shopify app, tap Menu, and then tap Settings Settings.

  2. In the Store settings section, tap Metafields and metaobjects.

  3. Depending on the metafield definition that you want to use for collections, select either Products or Variants.

  4. Tap the metafield definition that you want to use for your collection.

  5. In the Options section, tap Collections.

  6. Tap Save or .

Add metafield definition conditions to a collection

You can add a condition to include products or variants with a particular metafield. You can use product metafields or variant metafields. For example, you can set up a condition that selects products with the metafield definition Color and the value #FF0000.

Steps:

  1. From your Shopify admin, go to Products > Collections.

  2. Click a collection that you want to add products to.

  3. In a Products source or a Variants source, click AddAdd condition > Metafield.

  4. Select Color as the metafield definition.

  5. Click the Select value field, and then select #FF0000.