From 13bdd0c8e74db7b721a93640b9d7f54c47e439ee Mon Sep 17 00:00:00 2001 From: Rafael Cassiano Date: Thu, 17 Oct 2024 12:04:39 -0300 Subject: [PATCH] fix: include filter price in facets (#933) --- vtex/loaders/intelligentSearch/productListingPage.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vtex/loaders/intelligentSearch/productListingPage.ts b/vtex/loaders/intelligentSearch/productListingPage.ts index 01385a868..b392cfd3e 100644 --- a/vtex/loaders/intelligentSearch/productListingPage.ts +++ b/vtex/loaders/intelligentSearch/productListingPage.ts @@ -132,6 +132,11 @@ export interface Props { * @description The URL of the page, used to override URL from request */ pageHref?: string; + + /** + * @title Include price in facets + */ + priceFacets?: boolean; } const searchArgsOf = (props: Props, url: URL) => { const hideUnavailableItems = props.hideUnavailableItems; @@ -264,7 +269,7 @@ const loader = async ( ? filtersFromPathname(pageTypes) : baseSelectedFacets; const selected = withDefaultFacets(selectedFacets, ctx); - const fselected = selected.filter((f) => f.key !== "price"); + const fselected = props.priceFacets ? selected : selected.filter((f) => f.key !== "price"); const isInSeachFormat = Boolean(selected.length) || Boolean(args.query); const pathQuery = queryFromPathname(isInSeachFormat, pageTypes, url.pathname); const searchArgs = { ...args, query: args.query || pathQuery };