Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How to get one of product tags via get product data (Right formula)

Solved

How to get one of product tags via get product data (Right formula)

EunorauEbikes
Excursionist
23 0 6

As u see, i have one product with many tags, one of them is " '- tag__sale_Coming Soon "(*As below pictures show ).

This flow is designed for "every day the flow check if any product‘s status is active and inventory >0,  especially has one specific tag  '- tag__sale_Coming Soon ", then remove this tag and a new tag.

So my question is how should i write its advanced queries:

1, status:active and inventory_total:>0 AND tag:"'- tag__sale_Coming Soon", whether should i add ""(quotes) in it due to one whitespace here.

2, status:active and inventory_total:>0 AND tag contains sale_Coming, if wanna retrieve it using part of this specific tag, could i use "contains" in this situation?

3, Is there any issue that i need to pay attention to?

Really appreciate anything u will say!

 

07.12.jpg001.jpg002.jpg

Accepted Solution (1)
paul_n
Shopify Staff
1431 157 332

This is an accepted solution.

You need the double quotes. Single quotes might also work. 

 

I recommend testing your query before you try to run actions based on it. You can either use something like an API client, or GraphiQL. Or you can put an action after the Query to output what it retrieves (I use the Log Output action). That way you don't have to just hope it works. 

 

This article has good details about how to test and see data/output: https://help.shopify.com/en/manual/shopify-flow/reference/data

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 8 (8)

Kalen_Jordan
Shopify Partner
779 36 141

You can't do a tag contains query filter. It only will do exact matches for tags. I'd recommend not using special characters in the tag names just because it might get kind of confusing and you could run into conflicts.

EunorauEbikes
Excursionist
23 0 6

Thank u Kalen,  the special characters are what the used theme requires. appreciate your sharing and pro guidance.  

Kalen_Jordan
Shopify Partner
779 36 141

Ah I see. Should be possible to use those as long as you're doing exact matches.

 

EunorauEbikes
Excursionist
23 0 6

so should i still remove the double quotation marks? what's the right formula that i need when there is a special character and a blankspace?

paul_n
Shopify Staff
1431 157 332

This is an accepted solution.

You need the double quotes. Single quotes might also work. 

 

I recommend testing your query before you try to run actions based on it. You can either use something like an API client, or GraphiQL. Or you can put an action after the Query to output what it retrieves (I use the Log Output action). That way you don't have to just hope it works. 

 

This article has good details about how to test and see data/output: https://help.shopify.com/en/manual/shopify-flow/reference/data

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
EunorauEbikes
Excursionist
23 0 6

Thank u, Paul. it works, and one more question, did u know if i use "contains" as the operator,  how to write it for "edit query"?

I tried "status:active and inventory_total:>0 AND tag contains sale_Coming"  and “status:active and inventory_total:>0 AND tag contains “Coming Soon”, but all failed. do u know where the errors are? and how to fix them?

Thank u in advance!

paul_n
Shopify Staff
1431 157 332

"Contains" isn't a valid operator in queries. The UI links you to some docs on how to write various queries. https://shopify.dev/docs/api/usage/search-syntax

 

That said, I've heard you cannot use the partial matching search with tags. That might not be true, but test it first. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
EunorauEbikes
Excursionist
23 0 6

Got it, thank u