mirror of
https://github.com/vercel/commerce.git
synced 2025-05-12 20:57:51 +00:00
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import productFragment from '../fragments/product';
|
|
|
|
export const getProductQuery = /* GraphQL */ `
|
|
query getProduct($handle: String!) {
|
|
product(handle: $handle) {
|
|
...product
|
|
}
|
|
}
|
|
${productFragment}
|
|
`;
|
|
|
|
export const getProductsQuery = /* GraphQL */ `
|
|
query getProducts($sortKey: ProductSortKeys, $reverse: Boolean, $query: String, $after: String) {
|
|
products(sortKey: $sortKey, reverse: $reverse, query: $query, first: 50, after: $after) {
|
|
edges {
|
|
node {
|
|
...product
|
|
}
|
|
}
|
|
pageInfo {
|
|
endCursor
|
|
startCursor
|
|
hasNextPage
|
|
}
|
|
}
|
|
}
|
|
${productFragment}
|
|
`;
|
|
|
|
export const getProductRecommendationsQuery = /* GraphQL */ `
|
|
query getProductRecommendations($productId: ID!) {
|
|
productRecommendations(productId: $productId) {
|
|
...product
|
|
}
|
|
}
|
|
${productFragment}
|
|
`;
|
|
|
|
export const getProductVariantQuery = /* GraphQL */ `
|
|
query getProductVariant($id: ID!) {
|
|
node(id: $id) {
|
|
... on ProductVariant {
|
|
id
|
|
title
|
|
selectedOptions {
|
|
name
|
|
value
|
|
}
|
|
coreVariantId: metafield(namespace: "custom", key: "coreVariant") {
|
|
value
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|