Skip to content

Tax Calculation

benjamin wil edited this page Feb 28, 2023 · 1 revision

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.

Technical overview of Solidus tax calculations

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::TaxRates to calculate taxes on a per item basis.

How Solidus TaxJar modifies the tax calculators

This extension configures the tax_calculator_class with a custom calculator. This calculator completely ignores Spree::TaxRates for the purposes of it's calculations and uses the tax amounts returned from the TaxJar API instead.

Using this extension alongside other tax calculation strategies

If you for example wanted to use Spree::TaxRates 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::TaxRates (or any other strategy). Your custom tax calculators can, of course, do whatever your business requires.