update inlinking blocks

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-07-05 15:19:40 +07:00
parent 7e9a84aaae
commit 0a2e3d8e38
5 changed files with 23 additions and 58 deletions

View File

@@ -1181,24 +1181,14 @@ export const getFile = async (id: string) => {
};
export async function getProductFilters(
{ collection, make }: { collection: string; make?: string | string[] },
{ collection }: { collection: string },
filterId: string
): 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>({
query: getProductFiltersQuery,
tags: [TAGS.collections, TAGS.products],
variables: {
handle: collection,
...(_make
? {
filters: _make.map((make) => ({
productMetafield: { namespace, key: metafieldKey, value: make }
}))
}
: {})
handle: collection
}
});