How to create a workflow for daily check users buying sum within the last 365 days?

Topic summary

Goal: Implement a VIP tag (Silver VIP) for customers who have spent $10,000 in the last 365 days, auto-applying a 10% discount at checkout via tag.

Issue: With a rolling 365‑day window, tags persist beyond eligibility (e.g., a customer qualifies by Sep 1, 2024, but on Jan 2, 2025 their last‑365‑day spend drops below $10k and the tag still grants a discount). Default Flow templates trigger on order events, not on scheduled recalculations. An attached screenshot shows an “order invalid” error when trying a template (image central to the error context).

Suggested approaches:

  • Limit the discount code to single use to avoid repeated auto-application.
  • Create a Flow to remove the VIP tag after first discount use, or to re‑evaluate and untag users once they fall below the threshold.
  • Use a scheduled trigger (e.g., every 10 minutes) that paginates customers 100 at a time and recalculates last‑365‑day spend; workable up to ~14.4k customers per day.

Status: Requestor asked how to initialize the scheduled Flow; concrete setup steps not provided. Paid implementation was offered. No confirmed resolution; discussion remains open.

Summarized with AI on December 25. AI used: gpt-5.

Recently I’ve been trying to apply a VIP tier level to our website, my rules was supposed to be: User who reached $10000 spending in the last 365 days, will automatically add a “Silver VIP” to the customer, at the same time i applied a code to the checkout page, customer with this tag can auto apply a 10% discount to their order. Which already works.

However, I couldn’t figure out how do I apply the flow correctly, for example:

The customer spent $8000 on 2024 Jan 1, and spent $2000 on 2024 Sep 1, therefore the system should add a vip to this customer, which the template flow could do so, however, on 2025 Jan 2, the customer trying to buy items, due to the tag is still on his account, it automatically gave him a 10% discount, which i didn’t want to due to he spent 10000 on prior 366 days instead of 365, how do I prevent this situation happens?

The template flow triggers is always start from order start instead of daily trigger, but daily trigger seems doesn’t work on this way, any idea on how to do this?

1 Like

Well, the code is working as expected. Using the Flow, you tagged the users who reached $10000 in one year and the code applies the discount based on tag. You can limit the discount code to be only one time use so it doesn’t add it next time.
You need to create a flow, that deletes the tag again or add code to tag and untag users once they receive their first discount.
Do press that like button, if this answer helps you.
DM us if you want me to implement that for you.

1 Like

You could do it as a scheduled trigger that runs every 10 minutes and paginates through your customers 100 at a time, if you have less than 14.4k customers that should work.

Hi can u give me an idea on how the flow should start? Because I get order invalid when I use the template

I can prioritize this faster on a paid basis if that’s of interest. There’s a link in my footer.