Home > widget-integration > CartDrawerRecommendationService > filterAvailableProducts

CartDrawerRecommendationService.filterAvailableProducts() method

Filter out products that are completely out of stock.

Removes products where no variants are available (i.e., all variants are OOS with "sell when out of stock" disabled). Products with at least one available variant are kept.

Override this method to customize product availability filtering logic.

Signature:

protected filterAvailableProducts(products: RawRecommendationProduct[]): RawRecommendationProduct[];

Parameters

Parameter

Type

Description

products

RawRecommendationProduct[]

Raw products from API

Returns:

RawRecommendationProduct[]

Products that have at least one available variant

Example

Override to also filter by custom tags:

window.boostWidgetIntegration.extend('CartDrawerRecommendationService', (Base) => {
  return class extends Base {
    filterAvailableProducts(products) {
      return super.filterAvailableProducts(products)
        .filter(p => !p.tags?.includes('hidden'));
    }
  };
});