-
Notifications
You must be signed in to change notification settings - Fork 12
Tax Calculation
This article summarizes how the Solidus TaxJar extension calculates tax.
This extension works by bypassing the default behavior of taxes in Solidus and instead making a request to the TaxJar API to calculate the taxes for the customer's tax address instead.
When we bypass the Solidus functionality and make a request to TaxJar's API, we're sending over all of the information that TaxJar needs to accurately calculate the tax for an order. That means we send all of the order's line item information, shipping fee subtotals, tax address, and so on.
When an order is updated through the Spree::OrderUpdater
, taxes are updated with the configurable tax_adjuster_class
.
The default tax_adjuster_class
will use the configurable tax_calculator_class
to calculate the taxes.
The Solidus default tax calculator will use the configured Spree::TaxRate
s to calculate taxes on a per item basis.
This extension configures the tax_calculator_class
with a custom calculator. This calculator completely ignores Spree::TaxRate
s for the purposes of it's calculations and uses the tax amounts returned from the TaxJar API instead.
If you for example wanted to use Spree::TaxRate
s for orders in Europe, but TaxJar for orders in the U.S., you could create your own tax_calculator_class
. Within this class, you could either direct tax calculation to the SuperGood::SolidusTaxjar::TaxCalculator
, or to a calculator that uses Spree::TaxRate
s (or any other strategy). Your custom tax calculators can, of course, do whatever your business requires.