Auto populate meta field with text from a product name

Solved

Auto populate meta field with text from a product name

HOCuser
Tourist
4 0 1

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]".

Accepted Solution (1)

tim
Shopify Partner
4490 532 1637

This is an accepted solution.

Can do this with Flow app:

Screenshot 2024-06-15 at 12.26.17 AM.png

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

View solution in original post

Replies 7 (7)

tim
Shopify Partner
4490 532 1637

This is an accepted solution.

Can do this with Flow app:

Screenshot 2024-06-15 at 12.26.17 AM.png

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
HOCuser
Tourist
4 0 1

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?

tim
Shopify Partner
4490 532 1637

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.

 

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
HOCuser
Tourist
4 0 1

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? 

 

HOCuser_0-1719342290641.png

 

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.

tim
Shopify Partner
4490 532 1637

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...

 

 

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
stevronsmds
Tourist
12 0 1

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

tim
Shopify Partner
4490 532 1637

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>

 

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com