Product count query returning wrong count

Hi All,

I’m running into a really odd problem with the GraphQL API. When I execute the following query:

{
  collection(id: "gid://shopify/Collection/323987800259") {
    id
    productsCount {
      count
    }    
  }
}

I get back the number of products in the collection, but if I then go to the Shopify Admin, and remove a product from that collection and run the query again, the product count still shows the old count.

The product count will continue to be wrong for GraphQL until I do something else that requires a save on the collection page (like change the title). If I execute the query after that, the count is correct again.

I can do a video to show what’s happening if that will help.

Thanks!

We’re having an issue where our query that is supposed to return variants that don’t have barcodes keeps returning the wrong results for some merchants. I suspect this is some kind of issue with caching, which we’ve observed for a long time. I’d recommend to record your screen and post here or submit a ticket to Shopify Support. These kinds of issues are affecting us all the time.

We’re experiencing this in Liquid beginning today: collection.products_count is returning 1 when there are indeed zero products in the collection.

Collection ID: 293588730018

Unfortunately this happens often. It seems there’s a delay for count to be processed, so if you wait 30-60 seconds, the count will be correct.