Skip to main content
Lunar provides configurable tax rules for calculating sales tax on orders.

Overview

Lunar provides manual tax rules to implement the correct sales tax for each order. For complex taxation scenarios (e.g. US states), integrating with a service such as TaxJar is recommended.

Tax Classes

Tax Classes are assigned to products and allow classification into taxable groups that may have differing tax rates.

Tax Zones

Tax Zones specify a geographic zone for tax rates to be applied. They can be based on countries, states, or zip/postcodes.

Tax Zone Countries

Tax Zone States

State lookups are scoped to the address country, so a state zone only applies to addresses in that state’s own country. This matters because state codes are reused across countries: WA is both Washington and Western Australia. Scoping was added in Lunar 1.5; earlier versions matched a state zone against any country.

Tax Zone Postcodes

Tax Zone Customer Groups

Zone resolution

Lunar\Actions\Taxes\GetTaxZone resolves the tax zone for an address, checking each type of zone in turn and returning the first match:
  1. Postcode — matched against the address postcode, honoring wildcards.
  2. State — matched against the address state, scoped to the address country.
  3. Country — matched against the address country.
  4. Default — the tax zone flagged as the default, returned when nothing above matches.
Passing no address (or an address with none of these fields set) returns the default tax zone. A cart can also override this resolution entirely, see Carts → Setting the Tax Zone.

Tax Rates

Tax Zones have one or many tax rates. For example, a zone might have a tax rate for the state and also the city, which collectively make up the total tax amount.

Tax Rate Amounts

Settings

  • Shipping and other specific costs are assigned to tax classes in the settings.
  • Tax calculation can be based on the shipping or billing address.
  • A default Tax Zone can be configured.

Extending

Sometimes the standard tax calculations are not sufficient, and custom logic may be needed, perhaps connecting to a tax service such as TaxJar. Lunar allows custom tax drivers to be implemented. See the Extending Taxation section for more information.