When querying (with GraphQL) the products count of a collection, in rare instances we return a negative number - which is obviously incorrect and causes a large number of issues for us.
query checkAssets {
collection(id: "gid://shopify/Collection/285327196259") {
productsCount {
count
precision
}
updatedAt
products(first: 250) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
title
}
}
}
}
}
This negative productsCount is also on the /collections/collection-handle.json version of the collection frontend:
The collection I’ve referenced has over 1000 products.
What is going on here?
Hi - thanks for flagging this, connecting with the relevant product team on this.
@Liam-Shopify
Here is another case. Can you confirm that it’s an internal issue?
I query that way:
collection(id: $id) {
title
productsCount {
count
precision
}
}
And I get: { title: 'test456', productsCount: { count: 26, precision: 'EXACT' } }
On the admin the same collection has 24 products:
I double checked that I used the right collection ID to query it.
Also note that after adding/removing products using the graphql api, the value is now correct
Hi - our devs have identified there is an issue on our side, and are working on a fix.
1 Like
Hi @Liam-Shopify
Is there any update on this?
Hi - our team are still actively working on this, but no ETA to share just yet.
@Liam-Shopify Some of the user of our app are wondering why these value are mismatching. May I ask if you’ve got any news for this one?
@Liam-Shopify
Do we have an update on this bug? The list of merchants experiencing this is increasing every day.
1 Like
await admin.graphql(`query {
productsCount(query: "") {
count
}
}`
)
This also returns a wrong number for some stores!
1 Like
Hi @Liam-Shopify , far from me the intention to disturb you, but did you have a chance to get any news on this? It’s a point of concern for some of our users, so it would be very helpful to hear from Shopify on this one