mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
✨ feat: (product detail) show category in relevant products
:%s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Facet } from "@commerce/types/facet";
|
||||
import { FacetValue, SearchResultSortParameter } from './../../framework/vendure/schema.d';
|
||||
import { Collection, FacetValue, SearchResultSortParameter } from './../../framework/vendure/schema.d';
|
||||
import { CODE_FACET_DISCOUNT, CODE_FACET_FEATURED, CODE_FACET_FEATURED_VARIANT, PRODUCT_SORT_OPTION_VALUE } from "./constanst.utils";
|
||||
import { PromiseWithKey, SortOrder } from "./types.utils";
|
||||
|
||||
@@ -116,6 +116,15 @@ export function getFacetIdsFromCodes(facets: FacetValue[], codes?: string[]): st
|
||||
return ids
|
||||
}
|
||||
|
||||
export const getCategoryNameFromCollectionId = (colelctions: Collection[], collectionId?: string ) => {
|
||||
if (!collectionId) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const collection = colelctions.find(item => item.id === collectionId)
|
||||
return collection?.name || ''
|
||||
}
|
||||
|
||||
export function getAllPromies(promies: PromiseWithKey[]) {
|
||||
return promies.map(item => item.promise)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user