productVariants `product_id` query field is not supported

Hi, I have defined the following query:

query GetProductVariants($query: String!) {
    productVariants(first: 25, query: $query) {
        nodes {
            id
            product {
                id
            }
        }
    }
}

with:

{
    "query": "product_id:gid://shopify/Product/6748599976070"
}

But I obtain:

{
    "data": {
        "productVariants": {
            "nodes": []
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 4,
            "actualQueryCost": 3,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 997,
                "restoreRate": 50.0
            }
        }
    }
}

Of course the product exists. What am I doing wrong ?

My final goal is to have all the variants of a product which have a specific metafield attached, but this part is not here yet since the first part of the query does not work

1 Like

I had tried the same query. I don’t know why, but you have to use only the integer from the product_id without gid://shopify/Product/ :face_with_crossed_out_eyes:

@Shopify_77 why do you change the logic behind in this query?