Creating tax exemptions for customers

Mihir Patel asked on July 9, 2019 07:31

Kentico 11 Website I have added a class CustomCustomerTaxClassService.cs for customer tax exempt in App_Code folder.

using CMS;
using CMS.Ecommerce;

[assembly: RegisterImplementation(typeof(ICustomerTaxClassService), typeof(CustomCustomerTaxClassService))]
public class CustomCustomerTaxClassService : ICustomerTaxClassService
{
    public CustomerTaxClass GetTaxClass(CustomerInfo customer)
    {
        if ((customer != null) && (customer.CustomerHasCompanyInfo))
        {
            return CustomerTaxClass.Exempt;
        }
        else
        {
            return CustomerTaxClass.Taxable;
        }
    }
}

and i am planning to change the code of GetTaxClass method as per my requirement but this method is never called when i am going through checkout flow.

At the same place, i have added CustomTaxCalculationService inherited by ITaxCalculationService to calculate tax with custom logic and it's working..

Is there something i am missing...

Recent Answers


Roman Hutnyk answered on July 9, 2019 09:07

It looks like you're missing Factory that serves Tax Service. See more details here.

0 votesVote for this answer Mark as a Correct answer

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