🚨 Announcing Vendure v2 Beta

TaxRate

TaxRate

A TaxRate defines the rate of tax to apply to a ProductVariant based on three factors:

  1. the ProductVariant’s TaxCategory
  2. the applicable Zone (“applicable” being defined by the configured TaxZoneStrategy)
  3. the CustomerGroup of the current Customer

Signature

class TaxRate extends VendureEntity implements HasCustomFields {
  constructor(input?: DeepPartial<TaxRate>)
  @Column() name: string;
  @Column() enabled: boolean;
  @Column({ type: 'decimal', precision: 5, scale: 2, transformer: new DecimalTransformer() }) value: number;
  @ManyToOne(type => TaxCategory)
    category: TaxCategory;
  @ManyToOne(type => Zone)
    zone: Zone;
  @ManyToOne(type => CustomerGroup, { nullable: true })
    customerGroup?: CustomerGroup;
  @Column(type => CustomTaxRateFields)
    customFields: CustomTaxRateFields;
  taxComponentOf(grossPrice: number) => number;
  netPriceOf(grossPrice: number) => number;
  taxPayableOn(netPrice: number) => number;
  grossPriceOf(netPrice: number) => number;
  apply(price: number) => TaxLine;
  test(zone: Zone, taxCategory: TaxCategory) => boolean;
}

Extends

Implements

  • HasCustomFields

Members

constructor

method
type:
(input?: DeepPartial<TaxRate>) => TaxRate

name

property
type:
string

enabled

property
type:
boolean

value

property
type:
number

category

property
type:
TaxCategory

zone

property
type:
Zone

customerGroup

property

customFields

property
type:
CustomTaxRateFields

taxComponentOf

method
type:
(grossPrice: number) => number

netPriceOf

method
type:
(grossPrice: number) => number

taxPayableOn

method
type:
(netPrice: number) => number

grossPriceOf

method
type:
(netPrice: number) => number

apply

method
type:
(price: number) => TaxLine

test

method
type:
(zone: Zone, taxCategory: TaxCategory) => boolean