Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I'm trying to create a workflow to handle a Pre-Order collection and New Releases collection via Flow. I have a Release Date in my Variant Metafields that I'd like to compare to "Now" or "Today" and essentially have anything in the future be placed into Pre-Order and anything in the past be removed. The New Releases would just be more about if that is within 60 days of "Now" or "Today".
It seems like this has to be done with the "Run code" action and javascript? I'm not super skilled in JS so wondering if someone has already worked this out for something or know a similar workaround?
Hi @randallpjenkins try liquid first, even though liquid isn't the greatest for doing date to date comparisons.
So convert to seconds(strings) to in turn convert to a number for size/number comparison
{% assign now = 'now' | date: '%s' | plus: 0 %}
{% assign release_date = product.metafields.schedule.release_date | date: '%s' | plus: 0 %}
{% assign mydate = 'now' | date: '%s' %}
{% if now < release_date %}
{% comment %}logic for preorders ...{% endcomment %}
{% else %}
{% comment %}logic for removal ...{% endcomment %}
{% endif %}
Meanwhile with javascript you'd need to try and pass in that date info as inputs since the run-code-action doesn't do clock based functions.
But if you do tons of tuts online for doing date comparisons in javascript.
If you need this automation built for you then contact me for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
What are you trying to achieve when marking a product as "Pre-order"? Do you just want different text on the ATC button, or a note on the product page? Or are you hoping to use a Pre-order purchase option (selling plan) in Shopify, so the fulfillment is correctly scheduled, partial payments are available etc.?
As Paul mentioned, if you just want to show some different text on the product page, it's probably easiest to code this in liquid.
For anything extra, I'd recommend using a pre-order app like ours to handle the scheduling of pre-orders, ensuring the customer is informed throughout their entire journey that it's a pre-order, and when the expected ship date is, and to offer things like partial pay/customizable discounts.
You can also set up simpler "back-order" functionality, which will let you just update the button text, show a note on the product page, and have a line item attribute carry through to checkout. This can easily be applied catalog-wide too (or for specific products).
I'd be happy to help walk you through any of this if you needed, or send you some step-by-step videos, just let me know (we have a 100% free plan with no commission fees too)!
Heddy from Gameball: Loyalty Program & VIP here!
To handle Pre-Order and New Releases collections based on the Release Date in your Variant Metafields, you're right that this will likely require some custom JavaScript using the "Run code" action in Shopify Flow. You'll need to compare the metafield date to the current date (new Date()) in JavaScript. For Pre-Orders, check if the release date is in the future, and for New Releases, check if the release date is within 60 days of today's date.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025