Custom tax calculation

asked on June 28, 2021 10:43

Requirement is to deduce tax depending on the user selection (selects if tax exempt or no), during the product ordering process. What is the best way to override default Kentico tax calculations and include additional options when the class should be calculated or not.

Correct Answer

Sean Wright answered on July 6, 2021 23:05

@Michael,

You can change the Customer to be in a taxable/non-taxable tax class (by setting the CustomerInfo.CustomerTaxRegistrationID) and then retrieve that (using ICustomerTaxClassService) in your custom ITaxCalculationService implementation since the TaxCalculationRequest contains the Customer:

var customerTaxClass = customerTaxClassService.GetTaxClass(request.TaxParameters.Customer);

if (customerTaxClass == CustomerTaxClass.Exempt)
{
    return 0m;
}

You could also create a custom implementation of ICustomerTaxClassService if you needed to.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Liam Goldfinch answered on June 28, 2021 10:56

Hi Michael,

I would recommend reading this part of the documentation. It talks about adding custom rules and custom logic for exempting taxes for users etc.

1 votesVote for this answer Mark as a Correct answer

answered on June 28, 2021 12:30 (last edited on March 28, 2024 05:44)

I decided to create a custom tax calculation service. I registered my implementation of the default tax interface and at the moment tax calculation functionality is successfully overriden.

Problem is that I do not have a clue how to pass user selection (as I mentioned, user has to select whether he will be tax exempt or not) to the tax calculator and this is located in one of the steps during the ordering.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.