Need Help creating workflow - need to auto generate impute to my Metafileds

i have so far 4 Metafileds under products and i am looking to automated this process

if somone can help me on how to create the workflow

  1. Brand Name - (product.metafields.custom.brand_name) look at the Vendor Fileds in shopify and move it to Mefailed called Brand with a specific rule, making each word first letter capital and the rest lower case

  2. Gender - (product.metafields.custom.gender) Look at the product type if the word Women appear match it preset metafiled (we sent up preset definition in metafiled for all gender Women, Men , Youth, etc..

  3. Categories - (product.metafields.custom.product_types) same as above just with categories

  4. Size Chart - (product.metafields.custom.size_chart) look for the brand name and search under pages for the brand name and the word size chart

You have a few typos that are making that hard to read. Also, it’s not clear when you need something like this to run?

what you did not understand ? i need them to run every time we add new products

Ok that helps. This is somewhat complicated, so first I would test things by using a workflow like:

  • Product added to store

  • Log output (one for each metafield you want to set to test out the Liquid code)

The final workflow would be something like:

  • Product added to store

  • Check condition

  • Update Product Metafield (Brand)

  • Update Product Metafield (Gender)

  • Update Product Metafield (Categories)

  • Update Product Metafield (Size)

I’m not sure if you always want to set those metafields or only when certain values are present. If the latter, you might put all of these branches in parallel (you can drag a connection from the trigger multiples times) and add a condition per branch.

In the update actions (testing via Log output), you will write a bit a of Liquid to get the values you want. The Liquid Flow uses it here: https://shopify.github.io/liquid/

For the “Preset” metafields, I think you mean that they are defined as single line text strings that can only be one of several present choices? You may have to hard-code those presets into Flow as accessing them through a MetafieldDefiniton looks very complicated in the API (possible but more work than just hard-coding).

To give you a head start on the Liquid, for brand I think you want something like:

{{ product.vendor | capitalize }}
// "pROducT Title" would become "Product title"

If you want to capitalize each work, I think you need to split by space, loop over the words, capitalize the same way, and then join again with a space.

I think (2) and (3) are possible.

For (4):

look for the brand name and search under pages for the brand name and the word size chart

What do you mean by “search under pages”? I don’t think there is an API for searching pages this way if you mean pages on the storefront.

That’s a lot, so I’ll leave it there. Give it a try and let us know where you get stuck.

Hi Paul

i use an inventory source that push inventory to shopify

once the product being created , we use metafields to create better filters for my products , so the brand name being pushed with all capitals, however i would like to show it with first letter capital and the the rest lower case to make it more nice

the gender and the category are all being pushed together to the product type field

so if a Product Type is Women Shoes , it will take the women for the gander and Shoes for the Categories

as to the number 4 , i created for each brand a Size Chart page under Online stores > Pages , so if the Brand is Adidas , i create a page called Adidas Size Chart and in Metafields under product.metafields.custom.size_chart i normaly would search for a page called Adidas Size Chart , so it would be the brand name withe word Size Chart

i dont know if its possible

again thank you for your help

Does every product type have a gender in it? It might be safer to do something like this if the answer is “not always”:

If product_type starts with “Women” → Set gender to Women

Else if product_type starts with “Men” → Set gender to Men

ok i need to know how to do it please

I put the triggers and actions you need above and the process for creating/testing it.

The below workflow template has a similar structure and the same trigger, if you want to use it as a starting point. I would start with the brand name one and test it again a product that doesn’t have the metafield set yet.

Hi Paul

i could not understand the flow you created , its stating the following

when product added > Check if Sku Include WTCH (i dont know what is that ?)

if yes add a tag and if not add product to collection same if sku include STRP

its not doing none of the conditions i was looking for

please help

there is no videos on how to create flo ?

This is a Flow overview:

https://www.youtube.com/watch?v=je6vfmO6Hp0

Flow help docs are here:
https://help.shopify.com/en/manual/shopify-flow

Hi Allen

i am trying to cerate a Flow that will do this

item in shopify inventory > That the product type include the word Women > add the word Women to Metafield

so under the metafiled namespace i put product.metafields.custom.gender but i dont know what to put under the fallowing Key, Value, Type

i also want to know if instead of " Inventory Item Create" i can select “Inventory Item that have no value under Metafiled " Gender” to update the value with the above flow

The namespace in your example is “custom” and the key is “gender”. The type depends on what you set of the metafield, but is probably a single line text.

I followed your instruction and added a test product to see if its adding the value, and it did not , i normally catch on fast , for some reason i do not understand the concept here ,

You changed your condition. I don’t think there is any scenario where you should use brackets. When inputting what data is expected in a condition, you definitely need to use the right operator and understand how it’s checking the value you put in there. See docs here: https://help.shopify.com/en/manual/shopify-flow/reference/conditions

To troubleshoot, look at the workflow run. My guess is that it didn’t even get to the Update product metafield step.

Hi Paul

i did with the old way and i also did with the new way , with and without the brackets (i did not put the brackets , it did it on its on) , again i do not understand the logic

this is a very confusing way to do the rules

i asked you to create one logic according my specification and you send me an example that have nothing to do with what i am trying to create

if you give me one Flow logic , i can follow the logic from that and do all the rest

you sending links to tutorials that i do not understand and not resolving my issue

if you can create one flow Triger with the following that would be appreciated

if a product type have the word “Women” populate the Metafiled called Gender with the word Women (regardless if its a new product or not, if the filed in metafiled is empty )

i am adding screenshot of my metrafileds how they appear in my product page

i also adding the new trigger without the brackets , i did not try with “begin with”

and also " Includes"

For updating a list of strings, here’s some sample code to get started

{%- assign current_mf = product.metafields | where: "namespace","custom" | where: "key","gender"| first -%}
{%- assign gender_list = current_mf.value | remove:"[" | remove:"]" | strip %}
{%- capture new_gender -%}
{%- if product.productType contains "Women" -%}
Women
{%- elsif product.productType contains "Men" -%}
Men
{%- endif -%}
{%- endcapture -%}
{%- if gender_list contains new_gender -%}
{{ current_mf.value }}
{%- else -%}
[{{gender_list}},"{{new_gender}}"]
{%- endif -%}

This code is valid but may fail if something is slightly off. If so, post the error message here.

Hi Paul

what do i do with this code? where do i added ?

Thank You

You put it in the metafield value field

i added there and still i get an error

Got error updating metafield: “Type ‘single_line_text_field’ must be consistent with the definition’s type: ‘list.single_line_text_field’.. Value does not exist in provided choices: [“Men”, “Women”, “Infant”, “Kids”, “Youth”, “Accessories”].” For value: “[,“Women”]”, Type: single_line_text_field