Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Parameter tag_not for argument query in Order API doesn't work

Parameter tag_not for argument query in Order API doesn't work

dmitry
Shopify Partner
11 1 2

I send this query:

{
  orders(first: 250, query: "tag_not:'test'") {
    edges {
      node {
        id
        processedAt
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

to endpoint admin/api/2023-07/graphql.json.

Instead of getting a list of orders that do not contain this tag, I get an empty array.

If I use the "tag" parameter, the api returns the correct response with an array of orders.

Moreover, within the same application, "tag_not" works for one shop, but does not work for the rest shops.

Replies 6 (6)

jpola12
Tourist
4 0 2

Hi @dmitry

 

I came across this thread from @Alan. It looks like your syntax is similar to what was causing the issue there, so perhaps make the suggested adjustments and retry.

 

Good luck!

 

dmitry
Shopify Partner
11 1 2

Thanks @jpola12 

 

Yes, indeed, this solution works when we have just one condition with the tag_not parameter, but if there are 2 tag_not parameters this solution does not work, for example:

tag_not: Test AND tag_not: Test2

erik_lindberg_s
Shopify Partner
23 3 8

Maybe something like this could work for you?

{
orders(first: 10, query: "(fulfillment_status:unfulfilled) AND (tag_not:'SomethingElse') AND (tag_not:'SomeThing') " ) {
nodes {
id
}
}
}



Liam
Community Manager
3108 344 910

Hi Vinnc87,

 

This does seem pretty weird, here's two things to check:

 

  • Does at least one order have the `test` tag? I believe for the `no_tag` filter to work there needs to be at least one order with the tag.
  • Does your app have the `read_all_orders` scope? 

Check the above and let me know if you're still seeing this issue.

Liam | Developer Advocate @ 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

dmitry
Shopify Partner
11 1 2

Hi @Liam 

 

1) Yes, some orders have 'Test' and 'Test2' tags
2) No, our app doesn't have this scope, only read_orders and write_orders 

Liam
Community Manager
3108 344 910

Can you add the `read_all_orders` scope and test this again?

Liam | Developer Advocate @ 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