Skip to main content

TaxZoneStrategy

TaxZoneStrategy

Defines how the active Zone is determined for the purposes of calculating taxes.

This strategy is used in 2 scenarios:

  1. To determine the applicable Zone when calculating the taxRate to apply when displaying ProductVariants. In this case the order argument will be undefined, as the request is not related to a specific Order.
  2. To determine the applicable Zone when calculating the taxRate on the contents of a specific Order. In this case the order argument will be defined, and can be used in the logic. For example, the shipping address can be taken into account.

Note that this method is called very often in a typical user session, so any work it performs should be designed with as little performance impact as possible.

info

This is configured via the taxOptions.taxZoneStrategy property of your VendureConfig.

Signature
interface TaxZoneStrategy extends InjectableStrategy {
determineTaxZone(
ctx: RequestContext,
zones: Zone[],
channel: Channel,
order?: Order,
): Zone | Promise<Zone> | undefined;
}

determineTaxZone

method
(ctx: RequestContext, zones: Zone[], channel: Channel, order?: Order) => Zone | Promise<Zone> | undefined