Cannot query with tag_not in store front API

FidelKang
Visitor
1 0 0

I'm trying to make a query which doesn't contain some tag. 

I found tag_not query  in the documents but it return empty results. (https://shopify.dev/api/admin-graphql/2022-04/queries/products)

I've also tried to make query with tag NOT 'abc' method but it also gives strange results. 

When tag_not query used for. Is there any way that I can make graphql query which find products that is not tagged by some query?

 

 

 

query {
products(query: "tag_not: 'None Table'", first:16, sortKey: BEST_SELLING){
edges{
node{
id,
handle,
title,
featuredImage{
url(transform: {preferredContentType:WEBP, maxWidth: 500})
},

priceRange{
minVariantPrice{
amount,
currencyCode
}
},
compareAtPriceRange{
minVariantPrice{
amount,
currencyCode
}
}
reviewCount:metafield(namespace: "reviews", key: "rating_count"){
value
}
reviewValue:metafield(namespace: "reviews", key: "rating"){
value
}
}

}
}
}

 

 

 

Reply 1 (1)

Alan
Shopify Staff
129 15 24

Hey @FidelKang 

 

Thanks for getting in touch - this is definitely an odd error. I was able to do a little testing on my end and encountered a similar error when I replicated your syntax in my test environment. I did find that the query seemed to work when I removed the extra " ' "/backticks from the query. For example I changed something like this:

 

products(query: "tag_not: 'None Table'", first:16, sortKey: BEST_SELLING){

 

 

into this:

 

products(query: "tag_not:None Table", first:16, sortKey: BEST_SELLING){

 

 

I also removed the space between the tag text you want to limit from the search and the "tag_not" param field. If you haven't yet tried this, can you give this a go and let me know if the query was successful? 

If not - if you can provide an X-Request ID from the response you'll receive from that query, can you share that with me? Having that ID will allow me to take a look at the logs on our end so we can further troubleshoot this. 

 

Hope this helps - feel free to reach out here with that Request ID if we can further assist with this. 

 

Cheers!

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog