import { productPrices, multipleChoiceOptionFragment } from '@framework/api/fragments/product'; const productInfoFragment = /* GraphQL */ ` fragment productInfo on Product { entityId name path brand { entityId } description prices { ...productPrices } images { edges { node { urlOriginal altText isDefault } } } variants { edges { node { entityId defaultImage { urlOriginal altText isDefault } } } } productOptions { edges { node { __typename entityId displayName ...multipleChoiceOption } } } relatedProducts { edges { node { name } } } localeMeta: metafields(namespace: $locale, keys: ["name", "description"]) @include(if: $hasLocale) { edges { node { key value } } } } ${productPrices} ${multipleChoiceOptionFragment} ` const productConnectionFragment = /* GraphQL */ ` fragment productConnnection on ProductConnection { pageInfo { startCursor endCursor } edges { cursor node { ...productInfo } } } ${productInfoFragment} ` export const customGetAllProductsQuery = /* GraphQL */ ` query getAllProducts( $hasLocale: Boolean = false $locale: String = "null" $entityIds: [Int!] $first: Int = 10 $products: Boolean = false $featuredProducts: Boolean = false $bestSellingProducts: Boolean = false $newestProducts: Boolean = false ) { site { products(first: $first, entityIds: $entityIds) @include(if: $products) { ...productConnnection } featuredProducts(first: $first) @include(if: $featuredProducts) { ...productConnnection } bestSellingProducts(first: $first) @include(if: $bestSellingProducts) { ...productConnnection } newestProducts(first: $first) @include(if: $newestProducts) { ...productConnnection } } } ${productConnectionFragment} `