Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hello all.
I'm new to the Shopify Flow app and I'm struggling to build a flow to do the following:
If a product has a specific tag, and has a metafield for a specific gender, and has a product type or A or B, then add those products to a collection.
Why? We tried to build an automated collection, but with the limited conditional options, we can't use AND/OR. We'd also prefer to not have to manually build the collection either, so I've been tasked with seeing if I can build a flow for it.
This is how it looks:
And the query is:
tag:tag-testing AND {{shop.gender.value}}:Mens AND product_type:Shirt OR product_type:T-Shirt
Based on the testing I've done, the flow does not 'like' this part: {{shop.gender.value}}:Mens - I suspect I've built this part of the query incorrectly, and that I don't know how to ask it to be equal to Mens.
The above variable was created like this:
And the query without that segment works perfectly:
tag:tag-testing AND product_type:Shirt OR product_type:T-Shirt
Any assitance that could be provided to help me correctly match the metafield gender and having that equal a supplied term, would be greatly appreciated.
Kind regards,
Nathan
Solved! Go to the solution
This is an accepted solution.
UPDATE - it works! Made one small change (cicled in red) and it made ALL the difference:
Thanks for all your help 🙂
Thanks for the suggestion. I tried it and it appears to have returned no results still.
My intial query of tag:tag-testing AND (product_type:Shirt OR product_type:T-Shirt) works though. It only fails when I add the query to check the gender metafield, leading me to believe I've built that segment wrong.
If the initial query on the "Get product data" action of tag:tag-testing AND (product_type:Shirt OR product_type:T-Shirt) works enough to filter down the list of products returned then it may be easier to continu into a "For each" loop and then iterates each through add a subsequent condition that evaluates the returned data for the desired metafield value (see example) before the "Add product to a collection" action. While less efficient, using the variable picker in the condition may be a more user-friendly approach to defining the metafield and value than having to figure out how to compose the query. You can then branch multiple conditions (and subsequent loops and actions) off the "Get product data" action for each metafield value and collection you care about.
Hello RPiii,
Firstly, thanks for your answer. I've tried that, and now have the following hurdle:
Ideally, I don't want to change the trigger as I want to dictate when the flow runs. As for the required for each loop, I'm unsure at where to insert that into the flow. Are you able to help me with that part?
Kindest regards,
Nathan
The "For each" loop would go after the "Get product data" to cycle through each of the products returned. Then you can check for the metafield value and perform the desired action. As Kalen said, this approach is limited to 100 products at a time.
Further to my initial post, I've experimented with the trigger.
Setting the trigger to 'Product variant inventory quantity changed' gave me the option to build a different flow:
Naturally, this flow only runs when a qualifying product has an inventory change, whereas, I'd like to ability to schedule this, or dictate specifically when I want it to run.
When setting up the trigger, these are two of my options:
Selecting a Shopify trigger lets me 'check if' something from within the product, for eg:
Whereas, using the Flow trigger (as it has schedule), doesn't seem to have access to the Product options:
I could 'cheat' the system by adding a variant to a test/draft product, triggering my desired flow:
But if there is a 'best-practice' method, I'd prefer that.
Apologies if the above went on too much. I'm new to Flows 🙂
I don't think you want to be getting gender from the shop object. You should get it from Product > metafields - it will prompt you for the namespace and key of that metafield.
I agree, but when I start with the schedule trigger from Flow:
It doesn't give me access to the product data, only Shop:
I feel I'm missing something really simple here..
Thanks for your reply though!
Oh yeah you'd want to get product data and then loop over those. You're going to be limited to 100 at a time though.
Hi Kalen,
We're back form the weekend, thanks for your paitence. I tried adding the For each loop after the get product data call, and it really dosen't seem to like my metafield much:
Any ideas on how to resolve this? Once again, I appreciate all the help!
Cheers,
Nathan
This is an accepted solution.
UPDATE - it works! Made one small change (cicled in red) and it made ALL the difference:
Thanks for all your help 🙂
Dropshipping, 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, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024