Home > widget-integration > FilterRender > handleCollectionOption
FilterRender.handleCollectionOption() method
Main handler for collection option clicks.
Routes collection filter selections to the appropriate handler based on current page context. On collection pages, redirects to the selected collection. On search pages, updates filters to show products from the selected collection.
Signature:
handleCollectionOption(action: {
key: string;
value: string;
handle: string;
collectionTag?: string;
originalCollectionTag?: string;
displayName?: string;
valueDisplay?: string;
}): Promise<void>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
action |
{ key: string; value: string; handle: string; collectionTag?: string; originalCollectionTag?: string; displayName?: string; valueDisplay?: string; } |
Collection selection action data |
Returns:
Promise<void>
Remarks
Automatically scrolls to top before processing the collection change. Override this to customize collection filter behavior per shop.
Example
Override to add custom analytics:
async handleCollectionOption(action) {
// Track collection selection
this.analytics.track('collection_filter_clicked', {
collection: action.handle,
context: this.isCollectionPage() ? 'collection' : 'search'
});
return super.handleCollectionOption(action);
}