tag_not in a Shopify Flow query. What am I doing wrong?

Solved

tag_not in a Shopify Flow query. What am I doing wrong?

IroncladTemplar
Tourist
10 0 1

Trying to get a Shopify Flow to send a daily reminder for inventory that is 'less than or equal' to zero, but to exclude products tagged with the following using a 'Get product data' advanced query:

- Cookie

- Cupcake

- Cake

- Brownie

- Bowl

- Rocky

This is what I wrote:

tag_not:Cookie,Cupcake,Cake,Brownie,Bowl,Rocky and inventory_total:<=0

As it exists right now, it emails me a list of 100 items, and it includes everything it shouldn't... What am I doing wrong?

Accepted Solution (1)
paul_n
Shopify Staff
1295 148 297

This is an accepted solution.

Simplify your query to something like 

tag_not:Cookie AND inventory_total:<=0

 

Then add back into more logic once it's working.

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)

paul_n
Shopify Staff
1295 148 297

When queries fail, they return all products.

 

You invented some syntax there that is not supported. See https://shopify.dev/docs/api/usage/search-syntax

 

In particular, you cannot add a list of things to a field like:

tag_not:Cookie,Cupcake,Cake,Brownie,Bowl,Rocky 

 

I think you would want something like

tag_not:Cookie AND tag_not:Cupcake 

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.
IroncladTemplar
Tourist
10 0 1

Thanks for the response, Paul. I tried this, but it did not work.

tag_not:Cookie AND tag_not:Cupcake AND tag_not:Cake AND tag_not:Bowl AND tag_not:Rocky AND tag_not:Brownie AND inventory_total:<=0

Any other suggestions that you think may work?

paul_n
Shopify Staff
1295 148 297

Make sure there is no white space in the field. 

 

I need more detail than "did not work" to be able to help. Can you describe what is happening now? 

 

This query for example works in my store:

tag_not:test AND tag_not:lens AND inventory_total:>0
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.
IroncladTemplar
Tourist
10 0 1

I'll try my best to convey what happened. With the query below it sent an email with 100 items out of stock, including things that were in the tag_not listings. 

tag_not:Cookie AND tag_not:Cupcake AND tag_not:Cake AND tag_not:Bowl AND tag_not:Rocky AND tag_not:Brownie AND inventory_total:<=0

As far as I can tell there is no white space in the query.

paul_n
Shopify Staff
1295 148 297

This is an accepted solution.

Simplify your query to something like 

tag_not:Cookie AND inventory_total:<=0

 

Then add back into more logic once it's working.

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.
yodankful
Shopify Partner
11 0 3

When I run this query via Graph QL, it returns only orders WITH the tag instead of all orders without the tag haha is that even possible?

 

orders(query:"tag_not:Special Terms")

paul_n
Shopify Staff
1295 148 297

Try putting single quotes around the tag name since it has a space

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.
yodankful
Shopify Partner
11 0 3

Wow.. lol, yup that did it! thank you so much Paul!