When is tax calculated in nopCommerce 4?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
In nopCommerce 4.0, it appears that activeTaxProvider.GetTaxRate is called multiple times before the customer reaches the cart.  This is going to cause us to run into some API limit overcharges with our tax provider, so I want to make sure we're only asking for tax when the customer is in the cart and has gotten beyond the billing and shipping address forms.  The problem is that I'm having a hard time determining exactly all of the places GetTaxRate is called so I can restrict them.  I also see it getting called after the customer has completed payment.  I'm not sure why that is.  Once the customer has paid, I don't think we need to get a tax amount again.

Ideally, there would be one call to GetTaxRate: when the user has entered both billing and shipping addresses and is on the last step of the cart before payment.

Can anyone guide me on where I can determine what is calling on GetTaxRate?

Thanks!

Jeremy
4 years ago
It would probably be best to put a Breakpoint in the GetTaxRate method, step through the cart and checkout, and then examine the Call Stack in the VS debugger when the breakpoints are hit.

Note that some 3rd party one-page checkout plugins might do 'excessive' calls to get cart subtotals, and also your settings for 'shipping is taxable', etc. could have impact.
4 years ago
I did some research and I found out some of what's happening.  GetTaxRate is calling the tax provider again after payment because the "TaxRate" session variable is getting lost -- becoming null -- between checkout/confirm and the ActionResult of loading the the Authorize.net payment plugin form.

I'm not sure why, but somewhere between clicking "Confirm" and the form loading, this session variable is obliterated.  

Jeremy
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.