Skip to content

Instantly share code, notes, and snippets.

@itailulu
Created June 5, 2025 07:11
Show Gist options
  • Save itailulu/1047b23e309c13a69aceda7c0cf6950d to your computer and use it in GitHub Desktop.
Save itailulu/1047b23e309c13a69aceda7c0cf6950d to your computer and use it in GitHub Desktop.
Shopify Storefront API GraphQL: Fetch Collection with Available Only Filter
query getCanadianCollectionProducts(
$handle: String!
$first: Int
$after: String
) @inContext(country: CA) {
collection(handle: $handle) {
id
title
handle
products(
first: $first
after: $after
filters: [
{ available: true }
]
) {
edges {
cursor
node {
id
title
handle
availableForSale
priceRange {
minVariantPrice {
amount
currencyCode
}
maxVariantPrice {
amount
currencyCode
}
}
# variants(first: 10) {
# edges {
# node {
# id
# title
# availableForSale
# quantityAvailable
# price {
# amount
# currencyCode
# }
# }
# }
# }
}
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
filters {
id
label
type
values {
id
label
count
input
}
}
}
}
}
# Variables:
# {
# "handle": "all-bras",
# "first": 20,
# "after": null
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment