Created
June 5, 2025 07:11
-
-
Save itailulu/1047b23e309c13a69aceda7c0cf6950d to your computer and use it in GitHub Desktop.
Shopify Storefront API GraphQL: Fetch Collection with Available Only Filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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