TaxCloud AddOn

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hi, I am writing a TaxCloud AddOn to make taxes easier for states like CA and NY. What do I need to call in the code to get the customer billing and shipping addresses?

Thank You,

Devon Quick
10 years ago
IWorkContext.CurrentCustomer.BillingAddress
IWorkContext.CurrentCustomer.ShippingAddress

You'll just want to have a reference to workContext in a constructor visible to Autofac, and it will hand you the current implementation.
10 years ago
Thank You!
10 years ago
mattsoundworld wrote:
IWorkContext.CurrentCustomer.BillingAddress
IWorkContext.CurrentCustomer.ShippingAddress

You'll just want to have a reference to workContext in a constructor visible to Autofac, and it will hand you the current implementation.


Actually, I was digging in a little, wouldn't it be better to get address from CalculateTaxRequest class since I implement ITaxProvider?

public CalculateTaxResult GetTaxRate(CalculateTaxRequest calculateTaxRequest)
10 years ago
Check out Nop.Plugin.Tax.CountryStateZip.CountryStateZipTaxProvider for an example of this in action below. You asked originally for both the shipping & billing address, but if you only need the address in CalculateTaxRequest, then yes, you can expect that information to be supplied by the calling service (checkout or order, not sure which)

 public CalculateTaxResult GetTaxRate(CalculateTaxRequest calculateTaxRequest)
        {
            var result = new CalculateTaxResult();

            if (calculateTaxRequest.Address == null)
            {
                result.Errors.Add("Address is not set");
                return result;
            }

            var taxRates = _taxRateService.GetAllTaxRates(calculateTaxRequest.TaxCategoryId,
                calculateTaxRequest.Address.Country != null ? calculateTaxRequest.Address.Country.Id: 0,
                calculateTaxRequest.Address.StateProvince != null ? calculateTaxRequest.Address.StateProvince.Id : 0,
                calculateTaxRequest.Address.ZipPostalCode);
            if (taxRates.Count > 0)
                result.TaxRate = taxRates[0].Percentage;

            return result;
        }
10 years ago
I was able to make my own TaxCloud Plugin for 3.10 (am sure works on 3.2 with some slight changes).

I did it mainly to deal with WA state.  I was using the WA State plugin which worked ok, but many times would give an error to where I couldn't log into the store because it couldn't load the tax tables.

I was surprised how may times the call to calculate tax was made when logging in.  I didn't have anything in the cart and after running the project, I put a breakpoint in the call and it was called about 5-6 times.  There was only 1 address for my user account.

Any ideas how to reduce the calls?
10 years ago
We're looking to do something similar with TaxCloud.  Any chance you'd be willing to share your code?
9 years ago
If anyone has some working code for this they would be willing to share it would be greatly appreciated.
8 years ago
Hi all!

I`m glad to inform, that new plugin for Tax is available!

TaxCloud handles every aspect of sales tax management, from collection to filing.

Calculates sales tax in real time for every state, county, city, and special jurisdiction in the US

visit https://taxcloud.net/ for more details.

older versions can be supported on request. Free of charge.

Link of plugin: https://www.nopcommerce.com/p/2054/socialbug-taxcloud-plugin.aspx

Use coupon code for 30% OFF: blackfriday30
Valid until Dec 2nd.


TaxCloud original post: https://www.nopcommerce.com/boards/t/38489/socialbug-taxcloud-plugin.aspx
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.