A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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 🙂
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.
To learn more visit the Shopify Help Center or the Community Blog.
There seems to be some kind of bug. I am not able to query for taxCode now.
Request:
query {
productVariants(first: 100) {
edges {
node {
title
id
taxCode
selectedOptions { name value }
}
}
}
}
Response:
{
"errors": [
{
"message": "Field 'taxCode' doesn't exist on type 'ProductVariant'",
"locations": [
{
"line": 8,
"column": 17
}
],
"path": [
"query",
"productVariants",
"edges",
"node",
"taxCode"
],
"extensions": {
"code": "undefinedField",
"typeName": "ProductVariant",
"fieldName": "taxCode"
}
}
]
}
Surely there must be a workaround to get a result of all Products or ProductVariants that have an empty taxCode. Why not just take the results of the following query into an array and then loop through to find all the products without a taxCode. Wouldn't that work?
{
products(first: 50) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
id
title
variants (first: 1) {
edges {
node {
taxCode
}
}
}
}
}
}
}