Search for null variant values using graphql and search syntax

Highlighted
Tourist
8 0 1

I'm trying to search for variants missing a taxCode and can't seem to get the query to return the correct results. I'm using the exists query:

 

query {
  productVariants(first:250, query:"-taxCode:*") {
    edges {
      node {
        title
        id
        taxCode
      }
    }
  }
}

Returns:

 

"data": {
  "productVariants": {
    "edges": [
      {
        "node": {
          "title": "Brown \/ Medium",
          "id": "gid:\/\/shopify\/ProductVariant\/13343879364660",
          "taxCode": "PC040129"
        }
      },
      ...
] } }

So obviously not a variant missing a taxCode :)

 

0 Likes
Shopify Staff
Shopify Staff
38 8 4

Hi there,

 

TaxCode is not a field that you can filter product variant search results on. If you are looking for product variants that are missing a taxCode, you will have to do so manually. 

 

 

0 Likes