Home > widget-integration > FilterHandler > handleMetadataActions

FilterHandler.handleMetadataActions() method

Handles metadata actions from data-metadata attributes.

Routes legacy metadata actions from DOM elements to appropriate event handlers. This supports the legacy filter tree system where elements have data-metadata attributes containing action configuration objects. Each action type triggers a corresponding EVENT_NAMES event. Override this method to add custom action types or modify action routing logic.

Signature:

protected handleMetadataActions(actions: Record<string, any>, target: HTMLElement): void;

Parameters

Parameter

Type

Description

actions

Record<string, any>

Object where keys are action types and values are action configuration objects

target

HTMLElement

The clicked DOM element that triggered the actions

Returns:

void

Remarks

Supported legacy action types: - optionList: Filter option list interactions - clearAllFilter: Clear all applied filters - clearFilter: Clear specific filter - removeFilterFromRefineBy: Remove from refine-by section - addToCart: Add product to cart - quickView: Open quick view modal - optionCollection: Collection multi-level navigation - filterOptionCollapse: Collapse/expand filter options - quickAddToCart: Quick add to cart popup - applyFilterOption: Apply filter option selection - resetFilterOption: Reset filter option to default - expandCollapseMultiLevel: Multi-level filter expansion

Example

Extend to add custom action type:

window.boostWidgetIntegration.extend('FilterHandler', (FilterHandler) => {
  return class CustomFilterHandler extends FilterHandler {
    protected handleMetadataActions(actions, target) {
      // Handle custom action before processing standard actions
      if (actions.customShopAction) {
        this.handleCustomShopAction(actions.customShopAction, target);
      }

      // Process standard actions
      super.handleMetadataActions(actions, target);
    }
  };
});