is there a way i can automatically fill metafields by reading tags for example if a tag is 6Y
can metafields be 6 years?
is there a way i can automatically fill metafields by reading tags for example if a tag is 6Y
can metafields be 6 years?
There are many ways to do it
first way is to add this code in your product template file
{% if product.metafields.custom.age %}
<p>{{ product.metafields.custom.age }} years</p>
{% endif %}
another way is to use javascript code
const ageTag = product.tags.find(tag => tag.match(/^\d+Y$/));
if (ageTag) {
const age = parseInt(ageTag);
metafield.value = age;
}
let me know if itâs working for you or not
Where can i add it?
and i have my tags for exampe 6Y is for 6 years, 7Y 7 years how do i add more the n 18 tags to t in this case?
How many products you have?
Who/what changes the tags?
How many tags you need to monitor?
How fast do you need the metafields updated?
Technically you can use Flow (free app) with Flow assistant (paid app) to run flow on âproduct tags added/removedâ trigger and add/remove metafield.
If you do not mind daily/hourly updates and/or less than 100 products, itâs easy to do with Flow only.
i have 3400 products , we add the tags, we need to ensure each tag is in the right product
i have 3400 products , and i need them to be updated at all times , for filtration purposes
Go to:
Online Store â Themes â Edit Code
search and open this file sections/main-product.liquid
then inside this div ()
insert this code
{% if product.metafields.custom.age %}
<p>Age: {{ product.metafields.custom.age }} years</p>
{% endif %}
another way:
{% assign age = ââ %}
{% for tag in product.tags %}
{% if tag contains âYâ %}
{% assign age = tag | remove: âYâ %}
{% endif %}
{% endfor %}
{% if age != ââ %}
<p>Age: {{ age }} years</p>
{% endif %}
Then Iâd recommend to
Unfortunately, Flow itself does not have âproduct tag added/removedâ trigger, this is why youâd need a âcompanionâ app.
Flow would be like this:
Alternatively, you can use only Flow, but update would not be immediate, say it will take up to half an hour:
the flow will run every 30 minutes, retrieve a list of products which has tag â7yâ but do not have metafield set to â7 yearsâ and set metafield on each of these products:
Those are basic flows to start with â there needs to also be a check if metafield is set, but tag is not, so remove the metafield;
and repeat for each tag/mf pair you want to monitor.
can we do a google meet call to help me with this ?
@mastrokmastrok if i add the first one as u said o i add it anywhere? also if something is 6Y as a tag does it read it as 6 years?Loom Message - 22 April 2026 | Loom
yes sure, happy to help
looking over your video give me some time
search for this div tag
<div class="product__info">
let me know if it works for you or else we can do a meet and we will assist you
How can we connect ?
Can we do a meet because I need to understand how all the tags or years will be read when they r different
If youâd like assistance resolving thisâespecially since it involves a custom implementationâweâd be happy to help. You can visit our profile to learn more about it and book a meeting at a time that works best for you.
Use the Shopify flow app with trigger âProduct Created/Updatedâ â Run code to transform the tag into readable formant(6Y->6 Years)-> Update Product metafield. use the metafield for filtering.
You can ask Sidekick to do this for you.
The only problem is that there is no âProduct updatedâ trigger in Flow.
You are right, there is only Product Created and Product status updated. The Flow companion is the right choice here.