Subscribe to Newsletter
#

Canadian Tax Plugin For Nopcommerce

Canadian tax plugin for Nopcommerce overview:

We have built this plugin and calling it “Tax By Country & State & Zip & With Multiple Tax”. This was built for a Canadian clients project. One is able to implement multiple taxes (in one cart) within country or state. This can be done with any Canadian Nopcommerce payment gateway.

For example:
Suppose, we have three taxes:

TPS (5%)
TPS (5%)
TVQ (7.5%)

If Amount total is 100

Then

 Total Amount Tax Amount Tax Name Calculated Tax Amount
100 TPS  5
95 5 TPS  4.75
90.25 7.5  TVQ 6.77
                                                         

 

How we can use the Canadian tax plugin for nopcommerce

Use this link:
Step1: Open the plugins set up url
Step2: Login through admin
Step3: Go to Configuration plugins
Step4: Search Plug-in name “Tax By Country & State & Zip & With Multiple Tax” and click on configure button.

Canadian Tax Plugin For Nopcommerce

Code Logic for Canadian tax plugin for nopcommerce:

We have created a plugin within the plugin folder in the web solution.

Canadian Tax Plugin For Nopcommerce

 

We have created this Canadian tax plugin for nopcommerce from default plug-in “Nop.Plugin.Tax.CountryStateZip”. At the time of installation, we create a new table “TaxRateMultiple”. We inherited checkout, Order and shopping controller from nop.web project. We are also created view files for show multiple taxes.

We have changed the login in ” OrderTotalCalculationMultipleService.cs”. We have done modifications while building the Canadian tax plugin for nopcommerce, When we calculate tax  like GetCountOfTaxs() and GetShoppingCartSubTotal().

decimal taxRate = decimal.Zero;
decimal sciExclTax = _taxService.GetProductPriceNew(shoppingCartItem.Product, sciSubTotal, false, customer, lstGetCount[i].Id, out taxRate);
decimal sciInclTax = _taxService.GetProductPriceNew(shoppingCartItem.Product, sciSubTotal, true, customer, lstGetCount[i].Id, out taxRate);
TaxRateMultiple ObjtaxRate = _taxRateService.GetTaxRateById(lstGetCount[i].Id);
//tax rates
decimal sciTax = sciInclTax - sciExclTax;

We have commented the default code and writen new logic on this function.

Modification on these pages only:

  1. Confirm.cshtml
  2. Detail.cshtml
  3. OrderTotals.cshtml

Modify internal file:

This modification is done in “Libraries\Nop.Core\Domain\Orders\order.cs” file for show admin side multiple taxes.
We have changed code in function:
protected virtual SortedDictionary <decimal, decimal> ParseTaxRates(string taxRatesStr)
{
}
In this function, we have to check “taxes.Length”. in default code
if (taxes.Length == 2)
{
}
But, we changed this code to
if (taxes.Length == 2 || taxes.Length == 3)
{
}
For show multiple taxes on admin side.

SVN Path

Canadian tax plugin for Nopcommerce Path: Plugins/Nop.Plugin.Tax.CountryStateMultiple/

You need to simply install this plug-in and do small change on order.cs file.

 

In case you have  any Nopcommerce requirements, please contact us.