We have B2B and D2C customers in our shop. but B2B customers can reach different discount levels depending on their spending of the last 365 days.
Currently, we need to check their spending over the last 365 days periodically (manually) and then may adjust their tags.
Would it be possible to use S.Flow to automate this?
Order created-> Check if the customer has the tag “xxx” (B2B customer tag)-> if yes → Check turnover of customer over the last 365 days → if over 2500.- add tag “XYZ” (discount level tag) to customer-> if over 5000.- add tag “ABC” (discount level tag 2) to customer…
The main thing I’m struggling with is the “last 365 days” part.
I now used:
“created_at:<=‘{{ scheduledAt }}’ AND created_at:>‘{{ scheduledAt | date_minus: “365 day” }}’”
for it (adapted to the standard “created in the last day” one, but it tells me “scheduledAt” is invalid
Any pointers?
It almost seems to work, thank you very much.
The only thing is, I seem not to be able to get the correct sum. When it runs it always gives me a sum I know is not correct for that account.