We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

use flow to list in-between numbers in a year range

use flow to list in-between numbers in a year range

automaniaaaa
Tourist
8 0 0

Hi Guys,

 

I run an auto parts store.

 

Products are linked to a vehicle via a metaobject and then made "accessible" to site search and filters when flow passes that data into separate metafields

 

flow1.png

The issue I'm having is on our Make, Model, Year form. Specifically on the "year" portion since products fall in a year range not a singular year and I don't want to list each year manually
 
Is it possible for flow to look at the year range e.g. 2012-2015 and list out the start, end and in-between years in the metafield? Here's the example of the output I'd like:
 
flow2.png
Also, is it possible for flow to treat "current" (we use for models which don't have a defined end year) as the current year and automatically update the year range when the year ticks over? Here's the example of the output I'd like:

flow3.png
By solving this, we would able to list all the applicable years Make Model Year form on the front end in a concise/standardized way
 
flow4.png
Replies 4 (4)
automaniaaaa
Tourist
8 0 0

Hi would love any advice. I can't PM you (your PM settings must not be on). Please msg me directly when you've got that setup

automaniaaaa
Tourist
8 0 0

Alternatively if you could steer me in the right direction in this public forum (even if only general principles) perhaps that advice could benefit someone else in future also...

Mivicle
Shopify Partner
18 1 5

To parse values from a single string and form a new string, it’s convenient to use the Run code action. If you don’t have programming skills, an AI like Anthropic Claude or ChatGPT should be able to handle such a script effectively.

Flow Companion app extends the capabilities of Shopify Flow
Feel free to reach out if you need to implement a workflow that cannot be implemented using the built-in Shopify Flow triggers/actions: flow-companion.support@mivicle.com
paul_n
Shopify Staff
1828 199 435

Not sure what type of metafield you have, but something like this in liquid might work when setting that metafield:

 

{% capture this_year %}{{ "now" | date:"%Y" }}{% endcapture %}
{% capture first_year %}{{product.myMetafield.value | first}}{% endcapture %}
{% for year in (first_year..this_year) %}
{{ year }}
{% endfor %}
Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.