Conditions for smart collections

You can add one or more conditions for a smart collection to match products based on many details, including product title or type, tags, price, or even inventory stock. Collections can have at most 60 conditions. Defining conditions for smart collections can automatically organize products without manual management, saving time as your catalog grows.

Set conditions based on product title, variant title, type, or vendor

You can add a condition to include a product in a collection based on the product's title, variant title, type, or vendor. You can select from the options in the second drop-down list to control how a product needs to match the condition value that you enter in the third field. The text that you enter in the third field is compared to your products according to the condition's settings, and matching products are included in the collection. The condition isn't case-sensitive.

You can select from the following options to control how a product needs to match the condition value that you enter:

Description of condition behaviors
TermDescription
is equal toA product needs to match exactly the whole value you enter.
is not equal toA product can't match the value you enter.
starts withThe beginning of the product title, type, or vendor matches the value you enter.
ends withThe end of the product title, type, or vendor matches the value you enter.
containsThe product title, type, variant title, or vendor contains the value you enter. You need to specify a value that is at least 3 characters long, and the value can't start or end with spaces.
does not containThe product title, type, variant title, or vendor doesn't contain the value you enter. You need to specify a value that is at least 3 characters long, and the value can't start or end with spaces.

Conditions for variants

If you set up a condition for a product that has variants, then that condition is true whether any variant matches the condition. This applies whether all conditions or any condition is selected.

For example, suppose you have a product that has five variants. Four of the variants have inventory, but one is out of stock. If you have a collection that has a condition of Inventory stock is greater than 0, then the product is included in the collection because at least one of the variants matches the condition.

Set conditions based on product category

You can set a condition to include products with a particular product category. For a condition that uses product category, select the desired category from the drop down.

For example, to set up a condition that selects products with the product category Televisions:

  1. Select Product category from the first drop-down list.
  2. Select is equal to from the second drop-down list.
  3. Select Televisions.

You can also include products from all sub-categories of a selected category by using the includes sub-categories of selected category condition. This will return products for all categories that are children nodes of the category you select.

For example, to set up a condition that selects products with the product category Clothing Tops and all its sub-categories, such as Shirts, Cardigans, and Bodysuits, set the following conditions:

  1. Select Product category from the first drop-down list.
  2. Select Clothing Tops.
  3. Select includes sub-categories of selected category checkbox from the drop-down list.

Set conditions based on product tags

You can set a condition to include or exclude products that have a particular product tag.

When a condition uses product tags, you need to enter the exact tag as a condition value. If you enter an invalid tag, then all your store's products are matched to the condition.

Example: Set up a condition that includes products tagged with accessories

  1. Select Tag from the first drop-down list.
  2. Select is equal to from the second drop-down list.
  3. In the text field, enter accessories.

Example: Set up a condition that excludes products tagged with accessories

  1. Select Tag from the first drop-down list.
  2. Select is not equal to from the second drop-down list.
  3. In the text field, enter accessories.

For more information about tags, refer to Tag formats.

Set metafield definition conditions based on metafield values

You can add a condition to include products or variant with a particular metafield value.

In order to have the metafields available to you when creating collections, you need to activate the smart collections setting for the metafield definition. You can have the smart collections setting activated on a maximum of 128 definitions per product metafield definitions and variant metafield definitions.

The first column of the drop-down list for your smart collection conditions is the name of your metafield definition. The second drop-down list or text box is your metafield values.

For example, to set up a condition that selects products with the metafield definition Color and the value #FF0000, do the following:

  1. Select Color from the first drop-down list.
  2. Select is equal to from the second drop-down list.
  3. Enter #FF0000.

Learn more about smart collections by metafields.

Metafield types support the following conditions:

Supported conditions for metafield types
Metafield definition typeConditions
True or falseThe True or false metafield definition type supports the following conditions:
  • equals
IntegerThe Integer metafield definition type supports the following conditions:
  • equals
  • greater than
  • less than
DecimalThe Decimal metafield definition type supports the following conditions:
  • equals
  • greater than
  • less than
RatingThe Rating metafield definition type supports the following conditions:
  • equals
  • greater than
  • less than
Single line textThe Single line text metafield definition type can be a single value or a list of values and supports the following conditions:
  • equals

Set conditions based on metaobject reference metafields

You can add a condition to include a product in a collection based on the value of a metaobject reference metafield. You can set conditions for both product and variant metaobject reference metafields.

For example, to set up a condition that selects products with the metaobject reference metafield Material that has the value Cotton, do the following:

  1. Select Material from the first drop-down list.
  2. Select is equal to from the second drop-down list.
  3. Select Cotton.

This functionality enables you to create smart collections that are based on standard taxonomy attributes.

Set conditions based on price, weight, or inventory stock

You can add a condition to include a product in a collection based on its price, compare-at price, weight, or inventory. You can set the condition to include products that match its value exactly, or products that are greater or less than its value:

Description of condition behaviors
TermDescription
is equal toA product needs to match the exact value.
is not equal toA product can't match the value.
is greater thanThe product is greater than the value.
is less thanThe product is less than the value.
is empty

Compare-at price only:

The product qualifies if any of its variants has an empty Compare-at price value.
is not empty

Compare-at price only:

The product qualifies if all of its variants have a Compare-at price value. This value can be zero.

The behavior for "compare-at price is empty" and "compare-at price is not empty" is based on the values of all product variants:

  • If any variant has an empty compare-at price, then the product matches the is empty condition.
  • For is not empty, all variants must have a compare-at price value (including zero) for the product to match.

For example, to set up a condition that includes products that are priced $100 USD or less:

  1. Select Product price from the first drop-down list.
  2. Select is less than from the second drop-down list.
  3. Enter $100.01.

Using multiple selection conditions

You can set more than one selection condition to control which products are included in a collection. You can choose whether products must match all the conditions to be included in the collection, or any of the conditions.

For example, suppose that you set the two following conditions for a collection:

  • Product tag is equal to shirt.
  • Price is less than $100.01.

If you select all conditions, then products are included only if they're tagged with shirt and are also priced at $100 USD or less. Products need to match both conditions to be included in the collection.

If you select any condition, then products are included if they're tagged with shirt or if they're priced at $100 USD or less. Products need to match only one condition to be included in the collection.

Set multiple conditions to define a range

To include the products with a price, weight, or inventory value within a range, you need to set more than one condition. The low end of the range is defined in one condition, and the high end of the range in another. You need to select all conditions to include only the products that fall within the range.

For example, to set up a collection that includes products priced within a range of $50-$150 USD, you would set up the two following conditions:

  1. Product price is greater than $49.99.
  2. Product price is less than $150.01.

Troubleshooting smart collection conditions

If you're experiencing issues with your smart collections, then review the following troubleshooting information.

In rare cases, smart collections might contain the wrong products. The collection might contain products that don't match its conditions, or fail to contain products that do match its conditions.

If this happens, then try the following workarounds to refresh the collection:

Refresh the collection by duplicating and removing a condition

  1. From your Shopify admin, go to Products > Collections.
  2. Click the smart collection that contains incorrect products.
  3. Choose any existing condition, such as "Product tag is equal to summer", and add a copy of that exact same condition. This forces the smart collection to update during the process of avoiding adding unwanted products to the collection.
  4. Click Save.
  5. Delete the duplicated condition and click Save again.
  6. Check to confirm if the issue has been resolved in both the Shopify admin and your storefront.

Refresh the collection by updating products

If only specific products are missing or incorrectly included, then you can force those products to update:

  1. From your Shopify admin, go to Products.
  2. Click the product that's missing from or incorrectly included in the collection.
  3. Make a minor change to the product, such as adding a space to the description or entering a compare-at price.
  4. Click Save.
  5. Revert the change by removing what you added.
  6. Click Save again.
  7. Refresh the collection page to confirm if the product is now correctly included or excluded from the collection.

If you make a change to a product or variant that should cause it to match or not match a smart collection's variant-based conditions, but the product remains incorrectly included or excluded from the collection, then you can resolve this by temporarily changing and then reverting the collection's conditions:

  1. From your Shopify admin, go to Products > Collections.
  2. Click the smart collection that isn't updating.
  3. In the Conditions section, make a temporary change to any condition. For example, change a price condition value by $0.01.
  4. Click Save. The collection refreshes and displays the message "Products in this collection are updating. Try refreshing this list in a minute."
  5. After the collection finishes refreshing, revert the condition to its original value.
  6. Click Save again.

Review the following common issues with condition operators to ensure your collections work as expected.

Exact vs partial matching

When setting up conditions, it's important to understand the difference between exact and partial matching:

  • is equal to: A product must match exactly the whole value you enter. For example, if you enter summer sale, only products with exactly that phrase will match, not products with summer sale 2024.
  • contains: The product attribute contains the value you enter anywhere within it. For example, sale would match products with summer sale, sale items, or clearance sale.
  • is not equal to: A product can't match the exact value. This is different from does not contain, which means the value can't appear anywhere in the attribute.

Numeric operators and workarounds

Smart collections don't have "greater than or equal to" or "less than or equal to" operators. To include the target value in your range, offset the value by 1 cent:

  • To include products priced at $100 or less, use: Product price is less than $100.01
  • To include products priced at $50 or more, use: Product price is greater than $49.99

Compare-at price conditions

Compare-at price conditions have specific behaviors that might be unexpected:

  • Zero (0) isn't the same as empty: A compare-at price of $0.00 isn't considered empty. To find products with a compare-at price set (including zero), use is not empty or is greater than 0.00.
  • Variant-level evaluation: If any variant of a product has an empty compare-at price, then the entire product matches the is empty condition. For is not empty, all variants must have a compare-at price value (including zero).
  • Default is NULL: By default, products and variants have a compare-at price value of NULL (empty), which isn't recognized by compare-at price conditions. You need to manually set a value on the product or variant for it to be recognized.
  • Setting to $0.00 excludes from sale collections: If you want to exclude a product from collections that use compare-at price isn't empty, set the compare-at price to $0.00.

Excluding products with "is not equal to"

When using is not equal to to exclude products based on categories such as Vendor or Type, the condition might not filter products correctly, especially when using multiple exclusions:

  • With all conditions, a product must not match any of the exclusion criteria to be included. This can be challenging when trying to exclude multiple vendors.
  • With any condition, a product is included if it doesn't match at least one exclusion criterion, which can inadvertently include products you want to exclude.

Consider using product tags with the is equal to condition instead for more reliable exclusions.