Skip to main content

ProductVariantPriceSelectionStrategy

ProductVariantPriceSelectionStrategy

The strategy for selecting the price for a ProductVariant in a given Channel.

info

This is configured via the catalogOptions.productVariantPriceSelectionStrategy property of your VendureConfig.

Signature
interface ProductVariantPriceSelectionStrategy extends InjectableStrategy {
selectPrice(
ctx: RequestContext,
prices: ProductVariantPrice[],
): ProductVariantPrice | undefined | Promise<ProductVariantPrice | undefined>;
}

selectPrice

method
(ctx: RequestContext, prices: ProductVariantPrice[]) => ProductVariantPrice | undefined | Promise<ProductVariantPrice | undefined>

DefaultProductVariantPriceSelectionStrategy

The default strategy for selecting the price for a ProductVariant in a given Channel. It first filters all available prices to those which are in the current Channel, and then selects the first price which matches the current currency.

Signature
class DefaultProductVariantPriceSelectionStrategy implements ProductVariantPriceSelectionStrategy {
selectPrice(ctx: RequestContext, prices: ProductVariantPrice[]) => ;
}

selectPrice

method
(ctx: RequestContext, prices: ProductVariantPrice[]) =>