mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
🔨 refactor: filter one product vatiant
:%s
This commit is contained in:
@@ -64,6 +64,7 @@ export type ProductCard = {
|
||||
collection?: string,
|
||||
isNotSell?: boolean
|
||||
productVariantId?:string
|
||||
productVariantName?:string
|
||||
}
|
||||
|
||||
export type SearchProductsBody = {
|
||||
|
@@ -5,7 +5,7 @@ import { normalizeSearchResult } from '../../utils/normalize'
|
||||
import { getAllProductsQuery } from '../../utils/queries/get-all-products-query'
|
||||
import { OperationContext } from '@commerce/api/operations'
|
||||
|
||||
export type ProductVariables = { first?: number, facetValueIds?: string[], collectionSlug?:string }
|
||||
export type ProductVariables = { first?: number, facetValueIds?: string[], collectionSlug?:string, groupByProduct?:boolean }
|
||||
|
||||
export default function getAllProductsOperation({
|
||||
commerce,
|
||||
@@ -32,7 +32,7 @@ export default function getAllProductsOperation({
|
||||
take: vars.first,
|
||||
facetValueIds: vars.facetValueIds,
|
||||
collectionSlug : vars.collectionSlug,
|
||||
groupByProduct: true,
|
||||
groupByProduct: vars.groupByProduct??true,
|
||||
},
|
||||
}
|
||||
const { data } = await config.fetch<GetAllProductsQuery>(query, {
|
||||
|
2
framework/vendure/schema.d.ts
vendored
2
framework/vendure/schema.d.ts
vendored
@@ -3039,7 +3039,7 @@ export type SearchResultFragment = { __typename?: 'SearchResult' } & Pick<
|
||||
SearchResult,
|
||||
'productId' | 'sku' | 'productName' | 'description' | 'slug' | 'sku' | 'currencyCode'
|
||||
| 'productAsset' | 'price' | 'priceWithTax' | 'currencyCode'
|
||||
| 'collectionIds' | 'productVariantId' | 'facetValueIds'
|
||||
| 'collectionIds' | 'productVariantId' | 'facetValueIds' | "productVariantName"
|
||||
> & {
|
||||
productAsset?: Maybe<
|
||||
{ __typename?: 'SearchResultAsset' } & Pick<
|
||||
|
@@ -8,6 +8,7 @@ export const searchResultFragment = /* GraphQL */ `
|
||||
sku
|
||||
currencyCode
|
||||
productVariantId
|
||||
productVariantName
|
||||
productAsset {
|
||||
id
|
||||
preview
|
||||
|
@@ -11,6 +11,7 @@ export function normalizeSearchResult(item: SearchResultFragment): ProductCard {
|
||||
price: (item.priceWithTax as any).min / 100,
|
||||
currencyCode: item.currencyCode,
|
||||
productVariantId: item.productVariantId,
|
||||
productVariantName:item.productVariantName,
|
||||
facetValueIds: item.facetValueIds,
|
||||
collectionIds: item.collectionIds,
|
||||
|
||||
|
Reference in New Issue
Block a user