Skip to content

Instantly share code, notes, and snippets.

@jaredkc
Created September 28, 2024 14:53
Show Gist options
  • Save jaredkc/ff77624cc9d3240b23023ab15db5c3fc to your computer and use it in GitHub Desktop.
Save jaredkc/ff77624cc9d3240b23023ab15db5c3fc to your computer and use it in GitHub Desktop.
Shopify GraphQL collection query with product metafield
query productCollection($handle: String!, $firstProducts: Int!, $metafield: String!) {
collectionByHandle(handle: $handle) {
id
title
productsCount {
count
}
products(first: $firstProducts) {
edges {
node {
title
handle
seo {
title
description
}
metafields(first: 1, keys: [$metafield]) {
edges {
node {
key
value
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment