revert accidental merging

This commit is contained in:
tedraykov 2024-07-08 17:56:18 +03:00
parent e0fb5e4a11
commit a9ad351786

View File

@ -1200,24 +1200,14 @@ export const getFile = async (id: string) => {
}; };
export async function getProductFilters( export async function getProductFilters(
{ collection, make }: { collection: string; make?: string | string[] }, { collection }: { collection: string },
filterId: string filterId: string
): Promise<Filter | null | undefined> { ): Promise<Filter | null | undefined> {
const [namespace, metafieldKey] = MAKE_FILTER_ID.split('.').slice(-2);
const _make = Array.isArray(make) ? make : make ? [make] : undefined;
const res = await shopifyFetch<ShopifyCollectionProductsOperation>({ const res = await shopifyFetch<ShopifyCollectionProductsOperation>({
query: getProductFiltersQuery, query: getProductFiltersQuery,
tags: [TAGS.collections, TAGS.products], tags: [TAGS.collections, TAGS.products],
variables: { variables: {
handle: collection, handle: collection
...(_make
? {
filters: _make.map((make) => ({
productMetafield: { namespace, key: metafieldKey, value: make }
}))
}
: {})
} }
}); });