Learn how to configure taxes in Spree
tax_rates
.
Products within Spree can be linked to Tax Categories, which are then used to influence the taxation rate for the products when they are purchased. One Tax Category can be set to being the default for the entire system, which means that if a product doesn’t have a related tax category, then this default tax category would be used.
Here’s the list of Tax Category attributes:
Attribute | Description | Example Value |
---|---|---|
name | The name of the tax category. | Clothing |
is_default | Indicates if this is the default tax category. | true |
tax_code | The tax code associated with the tax category. | 1257L |
tax_category
can have many tax_rates
, which indicate the rate at which the products belonging to a specific tax category will be taxed at.
Spree::TaxRate
object includes these attributes:
Attribute | Description | Example Value |
---|---|---|
amount | The tax rate amount as a decimal. This will be presented as a percentage. | 0.08 |
zone_id | The ID of the zone this tax rate applies to. | 1 |
tax_category_id | The ID of the tax category this tax rate is associated with. | 2 |
included_in_price | Indicates if the tax is included in the price (true) or added on top (false). | false |
name | The name of the tax rate. | California Sales Tax |
show_rate_in_label | Indicates if the tax rate (8%) should be shown in the label. | true |
config/initializers/spree.rb
Spree::Zone.match
is a method used to determine the most applicable zone for taxation. In the case of multiple matches, the closer match will be used, with State zone matches having priority over Country zone matches.
Spree::Calculator
. In most cases you should be able to use Spree’s DefaultTax calculator. It is suitable for both sales tax and price-inclusive tax scenarios. For more information, please read the Calculators guide.
DefaultTax
calculator uses the item total (exclusive of shipping) when computing sales tax.Spree::Config[:tax_using_ship_address]
setting) is changed for the order to outside this taxable zone, then the tax adjustment on the order will be removed. If the address is changed back, the tax rate will be applied once more.