Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include filter price in facets #933

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading