---
title: "Tag products as on sale when a compare at price is added"
description: "When a variant gets a compare-at price it did not have before, add the tag on-sale to its product. The trigger carries the compare-at price before and after the change, so a product that was already on sale is not matched again. Use the tag in an automated sale collection."
canonical: "https://docs.workflow-trigger-extensions.app/template-tag-on-sale"
---

# Tag products as on sale when a compare at price is added

When a variant gets a compare-at price it did not have before, add the tag on-sale to its product. The trigger carries the compare-at price before and after the change, so a product that was already on sale is not matched again. Use the tag in an automated sale collection.

One trigger, built-in Shopify actions only, no other app needed. Nothing in it is specific to a store, so it works as soon as it is imported.

![The workflow in Shopify Flow: Tag products as on sale when a compare at price is added](https://cdn-dev.eu.codecreationlabs.cloud/crm-tool/uploads/SjJ78gKLnLlocopCui3Cs62dJbGZ7F1n/91e49f542229e8c0.png)
*The complete workflow as it looks in Shopify Flow.*

## What it needs

- The app's permission **Product, Variant & Collection Data Access**. See [Permissions and data access](https://docs.workflow-trigger-extensions.app/permissions-and-data-access.md).
- Nothing else: turning the workflow on switches the trigger **Product Variant Price Changed** on in the app.

Install the Workflow Trigger Extensions app and grant Product, Variant & Collection Data Access on its Permissions page. Turning this workflow on switches the trigger on in the app.

## Get the workflow

1. Download the `.flow` file attached at the bottom of this page.
2. In your Shopify admin open **Flow**, click **Import** and choose the file.
3. Check the steps, then click **Turn on workflow**.

The file is an export from Shopify Flow itself. Do not edit it by hand; change the workflow in Flow after importing it.

## How it works

1. **Product Variant Price Changed** fires once per variant whose price or compare-at price changed and carries `priceChange` with the old and the new compare-at price.
2. The **Condition** continues when `priceChange.oldCompareAtPrice.amount` is empty and `priceChange.newCompareAtPrice.amount` is not empty.
3. **Add product tags** puts `on-sale` on the variant's product (`productVariant.product.id`).

## Make it yours

- Build an automated collection on the tag `on-sale` and your sale page fills itself.
- Import the template that removes the tag when the compare-at price is removed, so the tag ends with the sale.

> [!NOTE]
> **Good to know**
> Shopify's own Product updated trigger only sends the current compare-at price, so it cannot tell a new sale from an existing one.

## Next steps

- [Product variant triggers, step by step](https://docs.workflow-trigger-extensions.app/variant-trigger-tutorials.md) - every field this trigger sends, with more examples.
- [Workflow templates](https://docs.workflow-trigger-extensions.app/workflow-templates.md) - all templates.
- [Event history and troubleshooting](https://docs.workflow-trigger-extensions.app/event-history-and-troubleshooting.md) - check that the trigger fired.
