Skip to content

removeFilter

removeFilter is a DOM event that occurs whenever the filter is removed.

Event body

The removeFilter body has a TFilterConstructorOptions type which represents the details of the removed filter. It is optional so it might not exist.

Example

In this example we listen to removeFilter event and perform an action whenever it's emitted.

useStorefront(async (storefront) => {
    document.addEventListener('removeFilter', (event) => {
        const filterDetails = event.detail;

        const { id, name } = filterDetails

        console.log('Removed filter:', id, name);
    });
});