Home > widget-integration > FilterUrlHelper > getQueryParamByKey
FilterUrlHelper.getQueryParamByKey() method
Gets a query parameter value by key from current URL.
Signature:
getQueryParamByKey(key: string): string | null;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
key |
string |
The query parameter key to retrieve (e.g., 'pf_brand', 'sort') |
Returns:
string | null
The parameter value or null if not found. For multi-value parameters, returns only the first value.
Example
Get current sort parameter:
const sort = this.urlHelper.getQueryParamByKey('sort');
// Returns: 'price-asc' or null