How do you create an automatic Shopify collection based on metafields?

by Alfredo Pantoja

Create more accurate and flexible collections using metafields instead of tags

Metafields provide more accuracy, flexibility and structure than tags. Use the power of metafields to create endless automatic "smart" collections.

Create your metafield and enable smart collections

To create your metafield:

  1. Go to "Content" in your admin dashboard
  2. Click on "Manage" on the top right
  3. Smart collections can be enabled with either product or variant metafields. Click on whichever you prefer.
  4. Click on "Add definition" on the top right
  5. Fill out the "Name" field with whatever name you feel makes sense for this metafield - something descriptive that will remind you of what it does.
  6. It's also a good idea to fill out the "Description" field with more info that will remind you of what this metafield does
  7. Click on the "Select type" button
  8. Select the data type of your metafield. The "Single line text", "True or false", "Integer", "Decimal", and "Rating" data types work really well for this.
  9. Finally, scroll down and toggle on the "Smart collections" option. This enables the feature.

Set the values for your new metafields

You can now go to the admin view of any product or variant - depending on which type of metafield you created - and set the appropriate values for your metafield.

Metafield definitions and supported conditions

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

In the admin page for your product or variant, scroll all the way down to the "metafields" section.

Here you can adjust the values for your new metafield.

Metafield definitions and supported conditions for smart collections
Metafield definition type Supported conditions
True or false equals
Integer equals
greater than

less than
Decimal equals
greater than

less than
Rating equals
greater than

less than
Single line text (one value and list of values) equals

Create a smart collection using a Metafield

Keep the table above as a reference for which conditions you can use.

Last step - to create your automatic "smart" collection:

  1. Go to "Collections" page in your admin
  2. Click on "Create collection"
  3. Under "Collection type" select the "Smart" option
  4. In the "Conditions" section you can create as many conditions as necessary, and select whether your collection should meet "all conditions" or just "any condition".

Have fun with it. That's all there is to it!