Create a custom tax picker
The ITaxPicker interface allows you to apply custom logic when the Ecommerce module chooses which tax is going to be applied. To do this, you must perform the following:
- Create a class for your custom tax picker.
Create a class that will represent the tax picker. In this example the name CustomTaxPicker is used.
- Implement the ITaxPicker interface.
The interface requires the
FindTax method to be implemented
- Implement the FindTax method.
In this method you can apply custom logic when selecting the tax that is going to be applied. As arguments you receive the shipping address of the cart. If there is no shipping address defined, you the argument will be the billing address.
Use the following code sample:
- Register the custom tax picker.
In the Global.asax file, register the custom tax picker in the following way: