title: "Taxes"
Most e-commerce applications need to correctly handle taxes such as sales tax or value added tax (VAT). In Vendure, tax handling consists of:
In the GraphQL API, any type which has a taxable price will split that price into two fields: price and priceWithTax. This pattern also holds for other price fields, e.g.
query {
activeOrder {
...on Order {
lines {
linePrice
linePriceWithTax
}
subTotal
subTotalWithTax
shipping
shippingWithTax
total
totalWithTax
}
}
}
In your storefront, you can therefore choose whether to display the prices with or without tax, according to the laws and conventions of the area in which your business operates.
When a customer adds an item to the Order, the following logic takes place:
TaxLineCalculationStrategy.calculate() of the configured TaxLineCalculationStrategy is called, which will return one or more TaxLines.priceWithTax of the OrderItem is calculated based on all the above.The taxes on shipping is calculated by the ShippingCalculator of the Order's selected ShippingMethod.
This example shows the configuration properties related to taxes:
export const config: VendureConfig = {
taxOptions: {
taxZoneStrategy: new DefaultTaxZoneStrategy(),
taxLineCalculationStrategy: new DefaultTaxLineCalculationStrategy(),
},
orderOptions: {
orderItemPriceCalculationStrategy: new DefaultOrderItemPriceCalculationStrategy()
}
}