We are facing some issues to get the expected results from the Shopify API. Here is an example query to get products for collection AG and productType = Tee, but the graphql query we are using is not returning us the expected result.
Here is the API reference that we followed, API_VERSION = ‘2022-04’
Below is the GraphQL query:
query MyQuery {
collection(handle: "ag") {
products(filters: {productType: "Tee"}, first: 2) {
edges {
node {
id
productType
}
}
}
}
}
Query result returned:
{
"collection": {
"products": {
"edges": [
{
"node": {
"id": "gid://shopify/Product/767547",
"productType": "Denim"
}
},
{
"node": {
"id": "gid://shopify/Product/7267",
"productType": "Short"
}
}
]
}
}
}
See the returned products type is not “Tee”. But we have the products with this type in the store inventory.
Can someone please help with this? What is wrong with the query?