Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hi!
I'm wondering if there is a way to 'randomly' assign 1 of 2 specific tags to an order using Flow.
The use case here is that we want to randomly send specific inserts in our orders to then see if there's a difference in these customers' shopping behaviour later, where we can use the order tag to bucket the customers.
So, we'd have a flow that on order creation sets 1 of N (in our case 2) possible order tags.
That would be all (our logistics partner handles the rest).
Any ideas on how to accomplish this? I know that the Run Code action does not support math.random so any alternative solutions to this are appreciated.
Thanks!
Solved! Go to the solution
This is an accepted solution.
Run code would let you use Javascript to code something to manipulate the string and evaluate the result.
Good shout!
AFAIK this would look like "2019-09-07T15:50:00Z", correct?
Would you recommend looking at a specific part (i.e. the seconds) of the DateTime, or is there a way to convert to Epoch/Unix timestamp to get a number that is checkable for even/odd?
Not sure exactly what is available in Run code, haven't used it yet.
Thanks!
This is an accepted solution.
Run code would let you use Javascript to code something to manipulate the string and evaluate the result.
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025