Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Does anyone here know if it's possible to create a meta field that will auto-populate with a part of a product's name? We have thousands and thousands of items that we want to set up a custom sorting method for but it would take forever to edit each item to add in a custom metafield. I'm hoping we can create a meta field that will just pull the data it needs from part of the product's name. The part of the product name I want it to pull is within square brackets, like this "Product Name [Sub Name]".
Solved! Go to the solution
This is an accepted solution.
Can do this with Flow app:
This is an accepted solution.
Can do this with Flow app:
Hey Tim,
Thanks for replying. This looks great and I tested it out and it works pretty well but I'm hoping they there is a way to get it to tigger that doesn't require the status of the product updating. We have thousands of products so I'm trying to avoid needing do any part of this manually. Any thoughts?
Of course, the trigger in my flow is just an example.
Can use "Product added to the store", but then also would need to loop over existing products and update those, in a separate flow.
Say, you can have a flow which will run once, or daily, loop over products, skip ones with the metafields and update the rest.
If you have many products, this needs to be done carefully to not hit the limits.
Check https://help.shopify.com/en/manual/shopify-flow/advanced-workflows for further info.
Thanks again for your help so far Tim.
Do you know how I would get a Get Product Data pull to skip items that already have something in the metafield?
This flow I made currently works but it just pulls the same 100 items over and over. I tried to make a query to look for the metafield value but it did not work.
Yeah, you'd need an advanced query for this and I vaguely remember there was a problem with filtering by metafields, sorry not sure if it's still a problem, can't test right now.
However one workaround possible is to use tags for this purpose, say, select products without a tag, with query like tag_not:processed, process them and assign this tag...
Hey Tim,
Wanted to ask if the Flow app could do this for us......we are migrating our store into Shopify and all our products have unique product id numbers. The numbers are generated in our old system sequentially when new products are created. Many customers use these numbers and refer to them so we want to keep them.
We know we can import the existing product id numbers into a metafield. We are looking for a way to auto-create a sequential product id number for each new product added. It sounds like Flow may be able to do something like this.
So essentially we need to tell the app to "find the last product id number and add 1 to it to create the new product id number for this new product".
Does that sound doable for Flow?
Thanks
Should be doable.
Rather then searching for the last number each time, it is possible to store the id number in a shop metafield, trigger on "product created" or "product variant added", fetch the number from store metafield, increment, update product/variant metafield, update shop metafield.
May be some form of resource locking would be necessary if bulk product creation will cause non-unique id assignment.
However! Shopify already creates a unique id number for each product and variant, so I'd rather recommend using those. They may look different to what you already have, but they are guaranteed to be unique and you do not need generate them.
You can easily use a reference like this to cover both new and old products:
{% assign id = product.metafields.legacy.id | default: product.id %}
<h4>Product id is {{ id }}</h4>
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