Skip to content

How to Build an Automated Sale Collection on Shopify

Build a Shopify sale collection that updates itself: the compare-at price condition, the variant trap, and why discount codes never land in it.

How-to guidesThe diex team10 min read

A Shopify sale collection is usually built as an automated collection with a compare-at price condition. That gets you most of the way, and then two things break it. Products with inconsistent compare-at prices across variants quietly fail to show as on sale, and anything discounted by a code or an automatic discount never enters the collection at all. This article gives the recipe that works, shows the variant trap with a worked example, and covers what to do when the sale is a discount rather than a price change.

What makes Shopify treat a product as on sale

A sale price on Shopify is not a discount. It is two fields on a variant: Price and Compare at price. Shopify's guide to sale pricing is explicit that "Using sale prices is different from setting up discounts," and that to display a sale price you need to "Make sure that the value in the Compare-at price field is higher than the value in the Price field."

That distinction matters for collections, because automated collection conditions read product and variant fields. They do not read your discounts. A compare-at price lives on the variant, so a product condition can read it. A 20% off code lives in your discounts list and is applied in the cart and at checkout, so no condition can see it.

If you are still deciding whether to use compare-at pricing at all, we covered the trade-offs in when a strikethrough earns its keep. For this article, assume you have decided to mark down prices directly on the product.

Create the automated collection and add the compare-at price condition

Shopify's collections documentation describes collections that "Automatically add products or variants to a collection based on inclusion conditions that you set." Here is the build:

  1. In your Shopify admin, go to Products > Collections and click Add collection.
  2. Give it a title ("Sale" or "Clearance") and a description.
  3. Under the Products source, click Add condition.
  4. Choose Compare at price as the product attribute and is set as the criteria.
  5. Set the sorting method for the order products appear in.
  6. Set sales channel availability if you need to, then click Save.

One naming note, because the operator wording is easy to misremember. The operator is is set, not "is not empty." And is not set is not the mirror image you would expect. The condition examples page defines them separately: for is not set, "A product matches when any of its variants has an empty Compare-at price value," while for is set, "A product matches when all of its variants have a Compare-at price value. The value can be 0."

Read those two definitions again, because the asymmetry is where sale collections go wrong.

Why some of your sale items never show up: variants with mixed compare-at prices

"All of its variants" is a strict test. One blank variant and the product is out.

For example, say you sell a hoodie in S, M, L and XL at $60. You mark it down to $42 for a November sale and set the compare-at price to $60 on S, M and L. XL is nearly sold out, so you leave its price and compare-at price alone. Now:

  • The product does not match Compare at price is set, because one variant has no value. It stays out of your sale collection.
  • The product does match Compare at price is not set, because any variant with an empty value is enough. If you also built a "full price" collection with that condition, the hoodie lands there while three of its four sizes are marked down.

The same page's troubleshooting notes add the other half of the problem: "By default, products and variants have a compare-at price value of NULL (empty), which isn't recognized by compare-at price conditions." Nothing is wrong with your condition. The data is just incomplete.

Do not use $0.00 as a placeholder

The obvious workaround is to type $0.00 into the variants that are not on sale. Shopify's own pages pull in different directions here, so this is worth being careful about.

The condition reference says a product matches is set when all variants have a value and "The value can be 0," and its troubleshooting section says "A compare-at price of $0.00 USD isn't considered empty." But a later bullet on the same page says "If you want to exclude a product from collections that use compare-at price is set, set the compare-at price to $0.00 USD." Meanwhile the sale pricing page says that "If some variants have compare-at prices that are inconsistent (such as some variants having a compare-at price of $0.00 USD, or some being empty, or different values across variants), then the collection page won't display the product as being on sale."

So a $0.00 variant may or may not put the product in your collection depending on which page you believe, and even when it does, the collection page will not render the product as discounted. Do not build on that. Pick one of the two clean states Shopify recommends for a product: "Either remove all conflicting compare-at pricing and leave them blank, or ensure all compare-at prices are higher than their respective regular prices."

In practice that means two rules:

  • If a product is on sale, set a real compare-at price on every variant, even the ones whose price you did not change (set compare-at equal to a higher former price only if that is true, otherwise leave the whole product out of the sale).
  • If a product is not on sale, clear the compare-at field entirely. Shopify's guidance is to "Make sure to clear the field entirely for variants that shouldn't display a compare-at price."

Then test with one product before the promotion goes live. Open the collection in your admin, confirm the product is listed, then open the collection page on your storefront and confirm the strikethrough renders.

Code and automatic discounts put nothing in this collection: use a tag instead

This is where most sale collections quietly fail. If your sale is a 25% off code or an automatic discount rather than a price change, your products have no compare-at price, so a compare-at collection is empty no matter how carefully you build the condition.

Shopify is clear about what the storefront does and does not show. On the sale pricing page: "To display savings from discounts with crossed-out (strikethrough) prices on product pages and collection pages, you need to use a third-party discount app, or hire a Shopify Partner to build a custom solution for you." And: "Savings from automatic discounts or discounts that require a code to be entered are always displayed with a crossed-out price at checkout." Checkout, not the collection grid.

The same is true of discounts that run as Shopify Functions. Volume discounts, variable discounts and spend tiers from diex are applied by Shopify in the cart and at checkout, so they do not write a compare-at price onto your products either. If you want shoppers to see the offer earlier, put it on the product page: diex storefront blocks include a volume pricing table block and a spend tiers progress block, part of a theme app extension that needs an Online Store 2.0 theme. Use those for the offer itself, and a tag for the merchandising page.

The tag recipe:

  1. Pick a short tag per campaign, like sale-nov26 or clearance. Shopify lets you "apply up to 250 tags to each product," and tags can be "up to 255 characters," though its tags guide advises that "For ease of use, keep your tags short," suggesting tags of no more than 16 characters.
  2. Add the tag to every product in the discount. From Products, select the products and use a bulk action. Shopify's guide to adding and updating products notes "You can also add tags by using a bulk action," and the same for removing them.
  3. In the collection, add the condition Product tag is equal to your tag.

Tagging is also the only approach that handles mixed campaigns, where some products are marked down and others are covered by a code. Tag both groups and the page lists both. If you are weighing the two mechanisms, automatic discount vs discount code breaks down which to run.

If you run promotions often, Shopify Flow can apply tags for you. It is "a free app available on the Basic, Grow, Advanced, and Plus plans," and its action reference includes Add product tags, which "adds a tag to the product that triggers the workflow," and Remove product tags. A workflow can tag and untag on a schedule or when a product changes.

Combine conditions to keep clearance and seasonal sales apart

One "Sale" collection quickly becomes a problem: last season's clearance sits next to your Black Friday hero products, and shoppers who land on the page see the wrong thing first.

Split it with multiple conditions. When you add more than one, you choose whether products must "Match all conditions" or "Match any conditions." A useful pair:

Collection Conditions (match all)
Clearance Compare at price is set + Product tag is equal to clearance
Black Friday Compare at price is set + Product tag is equal to bf26

Two limits to plan around. Each Products or Variants source has a limit of 60 condition values, so build on tags rather than long lists of vendors or titles. And a Products source "includes a product with all of its variants, so use a Variants source when you want a collection to only include specific variants and not the whole product," which is the tool to reach for when only two sizes are marked down.

You can also keep pages clean with exclusions instead of extra tags. Click Exclude in the source and add conditions there. Exclusions are narrower than inclusions: the examples page notes that for exclusions "only the category, tag, type, and vendor condition types apply." They are also absolute: "Product exclusions always override any manual or automatic product inclusions." In a single source you can exclude individual products or exclude another existing collection, but not both. Excluding the clearance tag from your seasonal sale collection takes one condition and no retagging.

Clean the collection up when the sale ends

An automated collection empties itself only if the underlying data changes. Two jobs when the promotion closes:

  1. Clear the compare-at prices. Select the marked-down products, click Bulk edit, and use the Columns button to show compare-at price. Shopify's bulk editor documentation notes that "Each column in the table represents a product property, such as price, SKU, and compare-at price." Clear the field rather than typing 0.00. Shopify warns that "The more information you try to bulk change at one time, the longer your bulk changes will take to complete," and suggests CSV files for large volumes.
  2. Remove the campaign tag with a bulk action, or let a Flow workflow do it.

Then reload the collection and confirm it is empty or back to evergreen clearance only. Stale compare-at prices leave a strikethrough against a reference price that is no longer real, so clear them as soon as the sale ends.

Do this before your next promotion

  • Create one automated collection now with Compare at price is set plus a campaign tag condition, so the page exists before you need it.
  • Audit one multi-variant product you plan to discount: every variant either has a real compare-at price or a blank one, with no $0.00 placeholders.
  • Decide whether this promotion is a price change or a discount. If it is a discount, tag the products, because nothing will reach a compare-at collection on its own.
  • Put the offer itself on the product page, and keep the collection for navigation.
  • Add "clear compare-at prices and remove the tag" to your end-of-sale checklist in the same place you note the end date.

Sources

  1. Shopify Help Center: Collections
  2. Shopify Help Center: Automated collection condition examples
  3. Shopify Help Center: Automated collections
  4. Shopify Help Center: Sale pricing
  5. Shopify Help Center: Using product tags to group products
  6. Shopify Help Center: Add and update products
  7. Shopify Help Center: Bulk editing products and variants
  8. Shopify Help Center: Shopify Flow
  9. Shopify Help Center: Shopify Flow action: Add product tags

Drafted with AI from the sources above and checked automatically against them and our product facts. Spotted a mistake? Email help@diex.app.

More articles

Run the promotions you actually want to run

Install diex from the Shopify App Store. One plan at $29.99 a month, billed by Shopify.