Add Sales tax to Shopping Cart

PB S asked on October 3, 2014 22:22

Hi, I am getting sales tax amount from an external web service to which i need to pass country and state.

Where exactly in the shopping cart code do i need to apply this sales tax amount returned from my web service.

Recent Answers


Josef Dvorak answered on November 21, 2014 11:01

Hi,

If you want to completely bypass the Kentico tax calculation in Kentico 7, then the best way to return a custom tax amount is by overriding this method in ShoppingCartItemInfoProvider using a Custom Info Provider:

/// <summary>
/// Calculates the sum of all taxes which are applied to all shopping cart item units altogether. Result is in site main currency.
/// </summary>
/// <param name="item">Shopping cart item</param>
protected override double CalculateTotalTaxInternal(ShoppingCartItemInfo item)
{

You can get to the Country and State properties via the item parameter, read the associated objects from the database, and pass the information to your tax service:

item.ShoppingCart.CountryID;
item.ShoppingCart.StateID
0 votesVote for this answer Mark as a Correct answer

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