Skip to content

Commit

Permalink
fix: include filter price in facets
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelCassiano30011 committed Oct 15, 2024
1 parent 6fac346 commit 46a64f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vtex/loaders/intelligentSearch/productListingPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit 46a64f3

Please sign in to comment.