Template
- Cart drawer: single-column layout matching the site — no bag icon, no dividers, square images, tighter type, discount code form, estimated total, and a Go to Checkout button - Cart: per-line loading state so one row's update no longer disables every other row or the checkout button - Discounts: cartDiscountCodesUpdate mutation plus discountCodes on the cart fragment, wired to an applyDiscountCode store action - Products: fix "load more" returning the same first page — the query now takes an `after` cursor and getProductsPage exposes pageInfo - Collections: cards match the product cards (no border, radius, blurb, or CTA row) at 4-up on desktop and 2-up on mobile; section headers match the products section - Shop Pay: cart permalink with payment=shop_pay instead of the hosted shop-js element - Buttons converted to the shadcn Button component throughout - PDP: swipeable image carousel with dots on mobile, sticky info column, colour swatches never fall back to variant photos - Rename the store from Stride to Shop; larger header wordmark Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016jWbNNJLksC1QG8z8845FX
140 lines
2.5 KiB
JavaScript
140 lines
2.5 KiB
JavaScript
// Product Fragment for consistent product data
|
|
export const ProductFragment = `
|
|
fragment ProductFragment on Product {
|
|
id
|
|
title
|
|
handle
|
|
description
|
|
descriptionHtml
|
|
vendor
|
|
productType
|
|
tags
|
|
availableForSale
|
|
priceRange {
|
|
minVariantPrice {
|
|
amount
|
|
currencyCode
|
|
}
|
|
maxVariantPrice {
|
|
amount
|
|
currencyCode
|
|
}
|
|
}
|
|
compareAtPriceRange {
|
|
minVariantPrice {
|
|
amount
|
|
currencyCode
|
|
}
|
|
maxVariantPrice {
|
|
amount
|
|
currencyCode
|
|
}
|
|
}
|
|
images(first: 10) {
|
|
edges {
|
|
node {
|
|
id
|
|
url
|
|
altText
|
|
width
|
|
height
|
|
}
|
|
}
|
|
}
|
|
variants(first: 100) {
|
|
edges {
|
|
node {
|
|
id
|
|
title
|
|
availableForSale
|
|
quantityAvailable
|
|
selectedOptions {
|
|
name
|
|
value
|
|
}
|
|
price {
|
|
amount
|
|
currencyCode
|
|
}
|
|
compareAtPrice {
|
|
amount
|
|
currencyCode
|
|
}
|
|
image {
|
|
id
|
|
url
|
|
altText
|
|
width
|
|
height
|
|
}
|
|
}
|
|
}
|
|
}
|
|
options {
|
|
id
|
|
name
|
|
values
|
|
optionValues {
|
|
id
|
|
name
|
|
swatch {
|
|
color
|
|
image {
|
|
previewImage {
|
|
url
|
|
}
|
|
}
|
|
}
|
|
firstSelectableVariant {
|
|
id
|
|
image {
|
|
id
|
|
url
|
|
altText
|
|
width
|
|
height
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
// Get multiple products
|
|
export const GET_PRODUCTS_QUERY = `
|
|
${ProductFragment}
|
|
query GetProducts($first: Int!, $after: String, $query: String, $sortKey: ProductSortKeys, $reverse: Boolean) {
|
|
products(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {
|
|
edges {
|
|
node {
|
|
...ProductFragment
|
|
}
|
|
}
|
|
pageInfo {
|
|
hasNextPage
|
|
endCursor
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
// Get a single product by handle
|
|
export const GET_PRODUCT_QUERY = `
|
|
${ProductFragment}
|
|
query GetProduct($handle: String!) {
|
|
product(handle: $handle) {
|
|
...ProductFragment
|
|
}
|
|
}
|
|
`;
|
|
|
|
// Get product recommendations
|
|
export const QUERY_PRODUCT_RECOMMENDATIONS = `
|
|
${ProductFragment}
|
|
query GetProductRecommendations($productId: ID!) {
|
|
productRecommendations(productId: $productId) {
|
|
...ProductFragment
|
|
}
|
|
}
|
|
`;
|