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.
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025