From 087c5ecb93fea2e0dc1f733d361417f3cb8576a4 Mon Sep 17 00:00:00 2001 From: andr-ew Date: Wed, 21 Jun 2023 14:46:32 -0500 Subject: [PATCH] lib/shopify: add collection names to product query fragment --- lib/shopify/fragments/product.ts | 112 ++++++++++++++++--------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/lib/shopify/fragments/product.ts b/lib/shopify/fragments/product.ts index be14dedca..f8b5f7b73 100644 --- a/lib/shopify/fragments/product.ts +++ b/lib/shopify/fragments/product.ts @@ -2,63 +2,69 @@ import imageFragment from './image'; import seoFragment from './seo'; const productFragment = /* GraphQL */ ` - fragment product on Product { - id - handle - availableForSale - title - description - descriptionHtml - options { - id - name - values - } - priceRange { - maxVariantPrice { - amount - currencyCode - } - minVariantPrice { - amount - currencyCode - } - } - variants(first: 250) { - edges { - node { - id - title - availableForSale - selectedOptions { + fragment product on Product { + id + handle + availableForSale + title + description + descriptionHtml + options { + id name - value - } - price { - amount - currencyCode - } + values } - } - } - featuredImage { - ...image - } - images(first: 20) { - edges { - node { - ...image + priceRange { + maxVariantPrice { + amount + currencyCode + } + minVariantPrice { + amount + currencyCode + } + } + variants(first: 250) { + edges { + node { + id + title + availableForSale + selectedOptions { + name + value + } + price { + amount + currencyCode + } + } + } + } + featuredImage { + ...image + } + images(first: 99) { + edges { + node { + ...image + } + } + } + seo { + ...seo + } + tags + updatedAt + collections(first: 99) { + nodes { + handle + title + } } - } } - seo { - ...seo - } - tags - updatedAt - } - ${imageFragment} - ${seoFragment} + ${imageFragment} + ${seoFragment} `; export default productFragment;