How to Automatically Tag Products When Sale Price is Lower than Compare At Price

Topic summary

Users are working to create a Shopify Flow that automatically tags products as “On Sale” when the sale price is lower than the compare-at price, rather than manually tagging them.

Core Challenge:
Shopify’s suggested “Product updated” trigger doesn’t exist in Flow. Direct price comparison within conditions is also problematic—the interface only allows comparing against fixed numeric values, not dynamic product fields.

Recommended Approach:

  • Use a Scheduled trigger (hourly or more frequent)
  • Add Get product data action with a query filtering for recently updated products
  • Include For Each loop to iterate through returned products (max 100 per query)
  • Add conditions checking if compare-at price exists and is greater than price
  • Apply tag actions based on conditions

Key Technical Issues:

  • The “Get product data” action returns maximum 100 products at a time
  • Query syntax uses GraphQL format: updated_at:<='{{ scheduledAt }}' AND updated_at:>'{{ scheduledAt | date_minus: "1 hour" }}'
  • Within conditions, users must reference the specific item from the For Each loop, not the entire list
  • Testing can be challenging; using “Log output” action helps verify logic before implementing tag actions
  • Products with variants require careful handling of price comparisons

Alternative Solution:
A third-party app called Flow Companion was suggested, which triggers workflows when product variant fields change, eliminating the 100-product limit and providing real-time updates.

Status: Multiple users report partial success but continue troubleshooting specific configuration details.

Summarized with AI on October 24. AI used: claude-sonnet-4-5-20250929.

I have a collection of products that are on sale. Right now, those products are manually tagged with a product tag “On Sale”.

Instead of manually tagging the products, I would like to create a flow where products are tagged automatically whenever they are updated. Shopify’s help bot seems to think this is possible but the steps it provides do not seem to exist.

Here’s what it told me to do -

Sure thing! Here’s a step-by-step guide to create a workflow to tag products when the sale price is lower than the compare price:

  1. Open Shopify Flow from your Shopify admin.
  2. Click Create workflow.
  3. Set the trigger as Product updated. (This step doesn’t seem to exist.)
  4. Add a condition where Product price is less than Product compare at price.
  5. Set the action to Add tag to product.

Does anyone know how to make this work?

That action doesn’t exist in Flow, correct. Product updates can be very frequent, like on every inventory change. What change do you need in order to set that tag?

You can use this pattern:

  • Scheduled time trigger - every hour
  • Get product data (with criteria that matches what update you care about)
  • For each (product)
    • Add product tag
1 Like

Thanks for the response. You are right about the frequency of product updates. However in this case I don’t mind if it takes a few hours for the products to be labeled (and ultimately show up in the On Sale collection on the website).

In this case, the criteria that I care about are -

  • Price is not null
  • Compare-at-Price is not null
  • Price < Compare-at-Price
  • Product has been updated within XX hours
    • I see that Get Product Data will return a maximum of 100 products. I don’t anticipate over 100 products going on sale in a single day.

Could you or anyone that’s familiar with Flow syntax help with the remaining code needed to make this work? The problem is I don’t see how to write the logic to compare the two prices. Here’s what I have so far in pseudo-code (screenshot attached shows actual code)

  1. Run once a day at 4am
  2. Get products updated with the last day
  3. Check if the product’s Compare-at-Price exists, Then
  4. Check the product’s minimum Compare-at-Price is higher than or equal to the product’s maximum Price (This assumes variants have prices that might be different than each other. This isn’t something I’m concerned about but I’m trying to make this as helpful as possible for anyone reading it later.)
    1. I’m fairly sure what I have in the screenshot below is NOT comparing the Compare-at-Price with the Price. It seems the only option I have is to set a numeric value to compare against, which of course would defeat the whole purpose.
  5. Everything after this point is easy - do nothing if Compare-at-Price doesn’t exist or is higher than price, else add product tag “On Sale”.

P.S. The red arrow indicates were the logic problem is.

To add tags, you’ll need to use a For Each step right after “Get product data”. That will change your condition slightly (simplifies it a bit). Once you do that, I think you’ll be able to select the correct variable (right now it’s a list, so doesn’t show up).

I’m still struggling to get this to work. I’ve run a number of tests and regardless of what I try, no tags are added or removed.

Two potential issues I see are that some of our products have variants while most do not and compare-at price is usually only filled in when a product goes on sale. For most products, compare-at price is blank.

I’ve tried to address the latter by including the first condition ‘exists’ but I haven’t been able to find anything that talks about what ‘exists’ means. If a no value is entered in the compare-at price, is this field null? If a product doesn’t have any variants, what am I comparing (if anything) with the current logic?

I’m also wondering if these conditions are comparing the exact same item in the array (or list as it’s called in the flow), or is it looking for any item to meet the first condition, and then any other item to meet the second?

Here’s where I’m at right now -

For your first condition, you should be using the specific item and not “Get product data”. You are checking if any of the products returned has that amount.

Hi, Do you mind sharing a screenshot of the final flow? I’m trying to set up the same thing and struggling to make it work on my end. Thank you!

I don’t think a screenshot is going to help much. What part are you stuck on?

Here’s a screenshot, hope it helps. When setting up the conditions, make sure you’re working with the returned data. Also, be aware that testing your flow can be challenging. You’ll want to email yourself the products that are being returned in the array because sometimes a recently edited product would be included in the array and other times it would not.

II

I’m new to creating flows… what am I doing wrong?

Thanks! This helped get me further. I replied to Paul with a screenshot of where I’m at so hopefully he can help.

For “Get product data” you can only get 100 at a time. If there are more than 100 updates per hour, you need to filter it further via the query, run it more often, or it’s not going to work. It can run up to every 10 minutes.

Regarding the condition, you need to try to build the condition and submit a more specific request. Your summary in the screenshot isn’t detailed enough.

Do you have any advice on building the condition? I tried exactly what Speakunique posted, what I posted, and several iterations, and can’t get it to work.

I will run the query more frequently, but for now just trying to get the rest to work. I do have some products currently in the last 100 updated that should have been tagged, but were not.

P.S. Speakunique - sorry for hijacking your threat and causing you to get alerts :grimacing:

I think we just got it worked out : )

1 Like

That’s awesome @Newbie10 . You should share what you changed to help out the next person. :slightly_smiling_face:

It’s mostly working now, but still needs a few tweaks. I will for sure share once we are confident it’s worked out.

Hi Paul, can you tell me the proper way to change the “updated_at” timeframe to minutes? We tried replacing “1 hour” with “15 minutes” and “.25 hour” but neither returned the results we were expecting.

updated_at:<=‘{{ scheduledAt }}’ AND updated_at:>‘{{ scheduledAt | date_minus: “1 hour” }}’

“15 minutes” should work.

How do i fill out this section - i cant seem to find a way to get it to check for those things in my flow -

1 Like

It’s the exact same logic that was used as the conditions in the “For” loop but this time you want to use the values that were returned in the array.