Home > widget-integration > FilterController > getEnabledSwatches
FilterController.getEnabledSwatches() method
Retrieves the list of enabled product swatches from theme settings. Returns an array of enabled swatch configurations (swatches.1, swatches.2, swatches.3).
Checks theme settings for up to 3 swatch slots and returns only those that are enabled, preserving their configuration including display type, option name, etc.
Signature:
getEnabledSwatches(): any[];
Returns:
any[]
Array of enabled swatch configuration objects, empty array if none enabled
Remarks
Each swatch object contains configuration like isEnable, displayType, optionName, and other settings defined in the theme's product info elements.
Example
Override to filter or modify swatch configurations:
window.boostWidgetIntegration.extend('FilterController', (FilterController) => {
return class CustomFilterController extends FilterController {
getEnabledSwatches() {
const swatches = super.getEnabledSwatches();
// Only return color swatches for this shop
return swatches.filter(swatch =>
swatch.optionName?.toLowerCase().includes('color')
);
}
};
});