Home > widget-integration > CartDrawerRecommendationController > getProductVariantCount

CartDrawerRecommendationController.getProductVariantCount() method

Get the number of variants for a product from its DOM element. Checks data attribute or variant selector options.

Signature:

protected getProductVariantCount(productItem: HTMLElement): number;

Parameters

Parameter

Type

Description

productItem

HTMLElement

The product item element

Returns:

number

Number of variants (0 if no variants, 1+ otherwise)