Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
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
Solved! Go to the solution
This is an accepted solution.
When you add code, please use the icon that looks like </>...it makes it much easier to view the code. You may have to click "..." first to see it. That code doesn't make any sense. Going back to the code above, since you are trying to insert 2 values at the same time the approach doesn't fully work for Unisex (men, women).
I think this should work...
- I added quotes around the "Women"
- I removed quotes around {{ new_gender }}
- I added a conditional statement for Unisex
{%- 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"
{%- elsif product.productType contains "Unisex" -%}
"Men", "Women"
{%- endif -%}
{%- endcapture -%}
{%- if gender_list contains new_gender -%}
{{ current_mf.value }}
{%- elsif gender_list == blank or gender_list == "[]" -%}
[{{new_gender}}]
{%- else -%}
[{{gender_list}},{{new_gender}}]
{%- endif -%}
This is an accepted solution.
Hi Paul 😊 yes it worked , great job , thank you for your help and patient
i also managed to find out what did i do wrong with the categories the KEY should be "product_types" and not categories , you need to put there the last string in the KEY , so if teh metafiled is product.metafields.custom.product_types, the custom go under namespace and product_types goes under the key
and to add brand names it was very easy see below , i find out about it trough the app "React Flow" they make it very easy to create flows
without
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
First, the type in that metafield needs to be "List of single line text" and not "single line text".
Try this, which handles empty lists better:
{%- 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 }}
{%- elsif gender_list == blank or gender_list == "[]" -%}
["{{new_gender}}"]
{%- else -%}
[{{gender_list}},"{{new_gender}}"]
{%- endif -%}
Hi Allen It worked 👍 i added the new code , and the type i had to change it to "List of single line strings" since i did not had an option for "List of single line text"
so now under gender i have the following remaining, Men , Infant, Kids, Youth , Accessories, and also Unisex , for unisex i will need to add 2 strings , "Men" And Also "Women" so how would i go about the options with the code you gave me
and how do i do the unisex
and i also have to do the same with Categories , Limit to preset choices
Shoes, Sandals, Boots, ,Rain Boots, Clogs, Heels, Sneakers, Slippers, Cribs ,Bags, Coats, Jackets, T-Shirts, Socks, Leggings, Orthotics, Shoe Care, Backpack, Hand Bag
and last is the files for the size charts
Let me know
Thank You
Hi Paul did you had a chance to look at my other conditions ?
I've given you the pattern above to be able to do that. All of this logic is custom to your store, so only you know the rules to build.
Regarding the size chart, I don't think there is any way to do that unless you change how you do it.
Hi Paul , i used the pattern for Women and it worked , i also used it for Men and it worked as well (since i saw you added Men there, i also used it on Youth by changing the Name "Women" to Youth and it worked, however on other Metafileds its not working , i want to do the same for Categories , i changed the word gender with "categories" and i could not save it , it gave me an error ,see below
i also need a senario on gender that i can input "Men" And "Women" the product type have unisex
Thank You
{%- assign current_mf = product.metafields | where: "namespace","custom" | where: "key","Categories"| first -%} {%- assign Categories_list = current_mf.value | remove:"[" | remove:"]" | strip %} {%- capture new_Categories -%} {%- if product.productType contains "Shoes" -%} Shoes {%- elsif product.productType contains "Men" -%} Men {%- endif -%} {%- endcapture -%} {%- if Categories_list contains new_gender -%} {{ current_mf.value }} {%- elsif Categories_list == blank or Categories_list == "[]" -%} ["{{new_Categories}}"] {%- else -%} [{{Categories_list}},"{{new_Categories}}"] {%- endif -%}
{%- assign current_mf = product.metafields | where: "namespace","custom" | where: "key","Categories"| first -%}
{%- assign Categories_list = current_mf.value | remove:"[" | remove:"]" | strip %}
{%- capture new_Categories -%}
{%- if product.productType contains "Shoes" -%}
Shoes
{%- elsif product.productType contains "Men" -%}
Men
{%- endif -%}
{%- endcapture -%}
{%- if Categories_list contains new_gender -%}
{{ current_mf.value }}
{%- elsif Categories_list == blank or Categories_list == "[]" -%}
["{{new_Categories}}"]
{%- else -%}
[{{Categories_list}},"{{new_Categories}}"]
{%- endif -%}
You need to change that `new_gender` to `new_Categories`. This should be obvious in the error message as it will say something like "cannot find new_gender"
I had to say it after reading this thread... goddamn you're a patient man @paul_n
@NYCK you're expecting to get a tailored-to-you, ready-to-go solution for a situation that is unique to the details of your store's setup.
You're complaining for things such as... "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".. YES, he's giving you an example of a working solution, for you to learn and recognize the pattern and the process it involves, to be able to adapt it to whichever way your situation requires. Your replies and your attitude have been infuriating to read for me, so I can't imagine how Paul is being so patient and still trying to help you while remaining polite.
"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
Now, to be more helpful, some advice I can offer you (since @paul_n already covered the technical aspect of it) would be to think about your store's "business logic" a bit more, and to better refine the conceptual schema of your products and logistics.
Before trying to figure out how to automate inputting values as metafields, your first step should be to review the relevancy and usefulness of the data you're looking to add.
For instance, you have a Gender metafield... that includes "Youth" and "Infant" as possible values (as well as Accessories??). The list of options don't even make sense in the context of Gender. If, for example, you simplify gender to allow as options: Men, Women, Unisex, then the Shopify Flow logic becomes much simpler. Partly because the conceptual logic would also be simpler.
if productType contains "Women", set metafield to Women
if productType contains "Men", set metafield to Men
if productType contains "Unisex", set metafield to ["Women", "Men"]
Other semantic options to structure that metafield could be: Male/female (instead of Men/women that imply adults), or maybe: Men/Women/Boy/Girl.
For your issue #1 with Brand name being added as metafield from the Vendor attribute. Have you considered if you actually need to do it, or if there's a better/simpler way to achieve your objective for this? If your objective is only to have the brand written in a different way for display on the site, then metafields aren't even necessary. You're trying to fix a minor change with a complex/powerful tool, which is totally overkill. You can reach your desired outcome of using different letter capitalization when displaying the brand with a simple CSS rule (text-transform: capitalize) applied anywhere Vendor needs to be shown on the site.
- Take the time to rethink your logical structure of information you're dealing with.
- Take the time to read and actually understand the principles of using Shopify Flow, and going through some of the examples Paul has linked to (instead of dismissing it because it's not exactly what you need - you don't even know what you need!).
- If you still can't figure out even the simplest parts of using Flows (which btw, you don't seem to understand nearly as well as you think you do)... consider hiring a freelancer to help you achieve whatever you're trying to do.
- Make an effort to communicate better, specially when asking for help and expecting people to do most of the legwork for you.
Feel free to ignore any or all of this. @Paul_n can only hold you by the hand for a bit, which he has done plenty already. Past that, you need to figure things out for yourself. Good luck!
Dear Fredy , you took your time to complain about my question's, and you end it with "feel free to ignore and or all" and i was about to do that , but i decide to reply anyway , since you are very rude.
so firstly i assume that Paul is an adult, i am sure he can speak on his own, i do not think he needs a lawyer , i did not demand, or complain, i asked ,
the solution he offered originally did not work, so i ASKED if he can provide a solution using my case scenario , if he would have told me that i should hire a professionals , i would have thank him , and that would have been the end of that, and probably the end of me using FLOW
the flow was created for the shopify users to help us achieve things in an automated way, so if i did not understood the logic of flow , (i did my website on my own with no one help) i assume that MANY shopify users did not understood as well , i am sure that one of the main goal of shopify is that most shopify users be Abel to use the tools, shopify offer and succussed, that's why they hired Paul, there are people that catch on fast , and for some it will take more time
and there is always this one person that appear in forums, and he thinks he is in charge of lecturing to users on what they should ask and how to ask!!!!
and you have the nerve to lecture me about my logic of doing things (i own my business for 33 years)
This Community is to HELP, the reason people come here is to get HELP, since they DONT KNOW how it works, people like you feel good about themself by lecturing to this " GUYS THAT DO NOT KNOW WHAT THEY NEED" , dude , i am not here for lecture, if you can help that would be greatly apricate it , if you cant or don't feel i should get help, stay out!!! please don't lecture, i feel sorry for the people that close to you that ask you something they do not understands, they will just give up
don't even bother to reply
You did receive help. I even offered some tips myself. Some of them to bypass Flow and obtain the wished result in a much simpler way, since you're trying to use a more advanced tool that you clearly are struggling with, even on intro-level stuff.
But at some point or another, it comes down to you having to help yourself.
If you feel "lectured" by the advice that you should "take the time to try to understand the underlying pattern"... that's what's holding you back from figuring it out. Once you understand the function each part of the flow plays, you'll be able to apply the answers you received, instead of reverting to "okay now also have to do the same with Categories , Limit to preset choices Shoes, Sandals, Boots, ,Rain Boots, Clogs, Heels, Sneakers, Slippers, Cribs ,Bags, Coats, Jackets, T-Shirts, Socks, Leggings, Orthotics, Shoe Care, Backpack, Hand Bag".
The Flow app is basically a graphical interface to visually represent writing code, to take certain actions based on conditions. I was trying to help by pointing out that, by cleaning up the logical structure of your data, it would probably help make things easier to grasp and translate into the Flow you're seeking.
The help you're seeking has been given to you already. It's all here in this thread. But yes, feel free to ignore everything I said (which, funny enough, is the opposite of lecturing someone).
Good luck either way!
Fredy
i did not read your explanation since i was stuck on your comment " goddamn you're a patient man @paul_n "as if i am here to bother Paul, that's a wrong way to try helping someone, i know very well that Accessories is not logical under gender, however my products are being pushed to Shopify trough an 3rd party inventory management, they being pushed in a certain way that i cannot change that logic , that's why i created METAFILEDS that the filters on my website will make more sense , Accessories is a very minimal part of my inventory , and i will fix it later on , try pushing it out of gender , the rest of my structure is correct
the Gender, and the categories are being pushed to shopify as one filed , the program that was written for this integration was before shopify created metafiles , so instead of me adding the values manually , i was looking for an automated way to crate these values so under Gender, Paul created query for Women, so i managed under the logic, do the same for men, Women, Youth, Kids, etc.. however unisex i need to add 2 fields , Men and Women, i try few ways , didnt work, Under Categories i was trying to use Paul query and changing the word "Gender" with "Categories" and it did not work , as to brand name, my system send brand name in all capital, some brand name come all lower cases , and Shopify Treat Names with capital as different name if the same brand written in lower cases , so i get the the same brand name as 2 brands , and it looks bad , i cannot fix it in shopify since my program will Re write the correction, and no i cannot adjust it in the source (long story) so its not a normal case scenario , the last thing i am trying to automate is the size chart per brand , i understands its more difficult since it need to select a page , so i am using program to do the initial bulk work , and every time we getting new products i go and do this manually
my inventory system start adding color map (amazon require that) i am trying to created color map in shopify as well, however my system do not send this information to shopify , for example if there is a shoe color called Shadow Navy , the core map color would be Blue , however there are colors that are not so obvious , i have a very big inventory , i cannot do this manually , it must be in bulk since we talking about a lot of product's, so once i assign color map to all my products in my system i can export it out and import it to shopify using a program , but going foreword, i have to do it manually , unless there is away to do it trough FLOW
so what you stating that i am saying OK WHAT NOW, is not correct , i tried using the logic from what Paul gave me and it didn't work , only than i would post here for help
Thank You
Hi Paul Happy new Year
i did all the genders and its working fine , the only one that i was not able to do is the Unisex that should include 2 strings , Men & Women
i also tried using your query to do the categories, i do not get any error , but its not adding the word Shoes into metafileds under Categories, this is the query i added under value
let me know if you can help with the 2 issues i have , Unisex and also the categories
i have another question , why the flow cannot be more simple by just tell the flow, if you see the word Shoes in Product Type , please insert it to the metafiled under Categories, why we have to add the query ?
{%- assign current_mf = product.metafields | where: "namespace","custom" | where: "key","Categories"| first -%}
{%- assign Categories_list = current_mf.value | remove:"[" | remove:"]" | strip %}
{%- capture new_Categories -%}
{%- if product.productType contains "Shoes" -%}
Shoes
{%- elsif product.productType contains "Men" -%}
Men
{%- endif -%}
{%- endcapture -%}
{%- if Categories_list contains new_Categories -%}
{{ current_mf.value }}
{%- elsif Categories_list == blank or Categories_list == "[]" -%}
["{{new_Categories}}"]
{%- else -%}
[{{Categories_list}},"{{new_Categories}}"]
{%- endif -%}
> i did all the genders and its working fine , the only one that i was not able to do is the Unisex that should include 2 strings , Men & Women
You could add a condition to the top of the "if/elsif" list like"
{%- if product.product_type contains "Men" and product.product_type contains "Women" -%}
I'm not sure what query you are referring to in your question. I don't see any in your workflow.
Hi Paul for the Unisex , i would like to explain the logic again
the Product Type contain Unisex , so i would like to add the Value "Men" "Women" to METAFILED ,
this is what i put , but i got an error , so i may did it incorrectly
{%- 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 "Unisex" -%} Unisex {%- if product.product_type contains "Men" and product.product_type contains "Women" -%} {%- endif -%} {%- endcapture -%} {%- if gender_list contains new_gender -%} {{ current_mf.value }} {%- elsif gender_list == blank or gender_list == "[]" -%} ["{{new_gender}}"] {%- else -%} [{{gender_list}},"{{new_gender}}"] {%- endif -%}
it should look like this in the end
This is an accepted solution.
When you add code, please use the icon that looks like </>...it makes it much easier to view the code. You may have to click "..." first to see it. That code doesn't make any sense. Going back to the code above, since you are trying to insert 2 values at the same time the approach doesn't fully work for Unisex (men, women).
I think this should work...
- I added quotes around the "Women"
- I removed quotes around {{ new_gender }}
- I added a conditional statement for Unisex
{%- 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"
{%- elsif product.productType contains "Unisex" -%}
"Men", "Women"
{%- endif -%}
{%- endcapture -%}
{%- if gender_list contains new_gender -%}
{{ current_mf.value }}
{%- elsif gender_list == blank or gender_list == "[]" -%}
[{{new_gender}}]
{%- else -%}
[{{gender_list}},{{new_gender}}]
{%- endif -%}
This is an accepted solution.
Hi Paul 😊 yes it worked , great job , thank you for your help and patient
i also managed to find out what did i do wrong with the categories the KEY should be "product_types" and not categories , you need to put there the last string in the KEY , so if teh metafiled is product.metafields.custom.product_types, the custom go under namespace and product_types goes under the key
and to add brand names it was very easy see below , i find out about it trough the app "React Flow" they make it very easy to create flows
without
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024