Liquid, JavaScript, themes, sales channels
I'm filtering products, but the counts for "in stock" and "out of stock" don't match. In the response, filters.count shows "in stock = 2" and "out of stock = 12," but when I check the number of products associated with the collection in the display, "out of stock" should be 10. Is this a Shopify bug? Or does available=false refer to the number of products, excluding archived ones, rather than out of stock? If anyone has information, please share your knowledge.
<query>
query getProductsByCollection( \$limit: Int = 10 \$afterCursor: String \$sortKey: ProductCollectionSortKeys \$reverse: Boolean ) { collection(id: "gid://shopify/Collection/460299993388") { products( first: \$limit sortKey: \$sortKey reverse: \$reverse after: \$afterCursor filters:[ { available : true }, ] ) { edges { node { id title variants(first: 1) { edges { node { id title availableForSale } } } } } filters { values { count id input label } } } } }
<responce>
"filters": [ { "values": [ { "count": 2, "id": "filter.v.availability.1", "input": "{\"available\":true}", "label": "in stock" }, { "count": 12, "id": "filter.v.availability.0", "input": "{\"available\":false}", "label": "out of stock" } ] } ]
Solved! Go to the solution
This is an accepted solution.
This is an accepted solution.
User | RANK |
---|---|
36 | |
30 | |
12 | |
11 | |
8 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023