Override Tax Calculation

To support products with individual tax set we need to override ITaxService to make it take the product setting rather than the default tax info from the price group into account.

 


Relevant APIs

UCommerce.Catalog
ITaxService
TaxService

UCommerce.EntitiesV2
Product
PriceGroup

UCommerce.Extensions
DynamicProperty<T>()

Hands-on

  1. Set up a field with the PriceGroupControlFactory.
  2. Set a custom price group on a product.
  3. Inherit TaxService and override the CalculateTax method.
  4. Check the product for the field (take into account variants).
  5. Load the price group based on the id stored in the field.
  6. Calculate tax based on the loaded price group.
{{lineitem.ProductName}}

{{lineitem.VariantName}} - {{lineitem.Quantity}} x {{lineitem.FormattedPrice}} {{lineitem.FormattedPrice}}

Your cart is empty ;(
Total {{basket.FormattedProductsTotal}}
Checkout