What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: Customer spending 365 days

Solved

Customer spending 365 days

Dominic_Ti
Tourist
7 0 4

Hey,

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.

Thx for your help
Cheers
Dominic

Accepted Solutions (2)

Kalen_Jordan
Shopify Partner
796 37 143

This is an accepted solution.

Yeah shouldn't be a problem. Use get order data with created_at > 365 days ago. Then sum the values up.

View solution in original post

RPiii
Shopify Staff
96 16 34

This is an accepted solution.

If you change "scheduledAt" to "now" then it should work as that will execute when it's scheduled to run.

View solution in original post

Replies 6 (6)

Kalen_Jordan
Shopify Partner
796 37 143

This is an accepted solution.

Yeah shouldn't be a problem. Use get order data with created_at > 365 days ago. Then sum the values up.

Dominic_Ti
Tourist
7 0 4

Thank you.

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?

RPiii
Shopify Staff
96 16 34

This is an accepted solution.

If you change "scheduledAt" to "now" then it should work as that will execute when it's scheduled to run.

Dominic_Ti
Tourist
7 0 4

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.

Dominic_Ti_0-1722948431538.png

Dominic_Ti_1-1722948494573.pngDominic_Ti_2-1722948518973.png

 

Any tips?
Cheers

RPiii
Shopify Staff
96 16 34

Do you have a link to your workflow that I could use to help debug the issue?

Dominic_Ti
Tourist
7 0 4

Thank you so much
how would I link the workflow?
Cheers