Home > widget-integration > FilterUrlHelper > checkExistFilterOptionParam

FilterUrlHelper.checkExistFilterOptionParam() method

Checks if filter option parameters exist in current URL.

Scans URL parameters for any that start with 'pf_' prefix, mapping shortened keys to long keys if URL shortening is enabled.

Signature:

checkExistFilterOptionParam(isShortenUrlParam?: boolean): boolean;

Parameters

Parameter

Type

Description

isShortenUrlParam

boolean

(Optional) Whether shortened URL params are enabled. If true, maps short keys to long keys before checking prefix. Default: false

Returns:

boolean

true if at least one filter parameter exists in URL, false otherwise

Example

Check if filters are applied:

const hasFilters = this.urlHelper.checkExistFilterOptionParam();
if (hasFilters) {
  this.showClearAllButton();
}