Skip to main content

ProductPriceApplicator

This helper is used to apply the correct price to a ProductVariant based on the current context including active Channel, any current Order, etc. If you use the TransactionalConnection to directly query ProductVariants, you will find that the price and priceWithTax properties will always be 0 until you use the applyChannelPriceAndTax() method:

Example

Ts
Signature

constructor

method(configService: ConfigService, taxRateService: TaxRateService, zoneService: ZoneService, requestCache: RequestContextCacheService) => ProductPriceApplicator

applyChannelPriceAndTax

method(variant: ProductVariant, ctx: RequestContext, order?: Order, throwIfNoPriceFound: = false) => Promise<ProductVariant>

Populates the price field with the price for the specified channel. Make sure that the ProductVariant being passed in has its taxCategory relation joined.

If the throwIfNoPriceFound option is set to true, then an error will be thrown if no price is found for the given Channel.

Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page