How to Automatically Mark Products with On-Sale Variants Using Metafields
Automatically identify and tag products with active sales, making it easy to filter, merchandise, and promote discounted items across your store.
The Problem
Merchants often struggle to accurately identify which *products* (not just variants) currently have an active sale, leading to missed opportunities for promotion and merchandising. Manually tracking this across hundreds or thousands of products is a huge time sink, risking outdated sales displays or even promoting items at the wrong price, harming trust and revenue.
What This Automation Solves
This Flow automates the entire process by running on a **scheduled trigger** every 10 minutes. It efficiently checks **if at least one variant of a product is on sale**, then automatically **updates a product metafield** to mark that product as 'on sale,' ensuring real-time accuracy without manual intervention.
When to Use This Automation
- You need to display 'On Sale' badges on product cards for any product with at least one discounted variant.
- You want to create automated collections of products that currently have active sales.
- You're syncing sale product data to a third-party app (like an ad platform or email marketing) that requires a clear 'on sale' flag.
Workflow
Trigger
Step 1Runs every 10 minutes starting Jun 27, 2024.
Action
Step 2Gets up to 10 products updated in the last 10 minutes.
Loop
Step 3Iterates over each product.
Condition
Step 4Checks if any variant is on sale.
Action
Step 5Sets the on-sale metafield.
Step-by-Step Setup
- 1
Configure the 'Scheduled time' trigger to run every 10 minutes.
- 2
Add a 'Get product data' action to fetch products updated in the last 10 minutes.
- 3
Initiate a 'For each' loop to process each retrieved product.
- 4
Create a 'Condition' that checks 'At least one of the product variants is on sale.'
- 5
In the 'Yes' branch, add an 'Update product metafield' action to set your chosen product metafield (e.g., `products.on_sale_variant.boolean`) to `true`.
Related Questions
- How can I display an 'On Sale' badge on products using this metafield?
- Once the Flow sets the metafield, you can modify your theme's product card snippet to check this boolean metafield and conditionally display an 'On Sale' badge or text.
- Can I use this metafield to create automatic product collections?
- Yes, you can create an automated collection with the condition 'Product metafield' where `[your_metafield_key]` 'equals' `true` to group all actively discounted products.
- What if I want to track products where *all* variants are on sale, not just one?
- This specific Flow tracks if *at least one* variant is on sale. To track if *all* variants are on sale, you would need a more advanced Flow condition or a specialized app.
- How often should this Flow run to ensure price accuracy?
- Running every 10 minutes, as configured, provides near real-time updates, which is generally sufficient to capture price changes quickly without excessive API calls.
Recommended Tools & Apps
Launch this automation
Open Shopify Flow and use this page as your setup blueprint.
Merchant Insight
To maintain accuracy, remember to also create a 'No' branch in your Flow. This branch should set the `on_sale` metafield to `false` when no variants are on sale, preventing outdated sales tags and ensuring clean data.
Related Automations
Automate Tagging for All International Shopify Orders
Automatically identifies and tags every order shipping outside your home country, streamlining fulfillment and customer service processes.
How to Automatically Tag Wholesale Orders for Fulfillment
Automatically tags orders from your wholesale customers, streamlining fulfillment and reporting without manual checks.
How to Alert Fulfillment to Gift Orders Automatically
Automatically notifies your fulfillment team via email whenever a new order is marked as a gift, ensuring special handling.