Tax Rates and Rules

In this guide, you’ll learn about tax rates and rules.

Looking for no-code docs? Refer to this Medusa Admin User Guide to learn how to manage tax rates using the dashboard.

What are Tax Rates?#

A tax rate, represented by the TaxRate data model, is a percentage amount used to calculate the tax amount for each taxable item’s price, such as line items or shipping methods, in a cart. The sum of all calculated tax amounts are then added to the cart’s total as a tax total.

Each tax region has a default tax rate. This tax rate is applied to all taxable items of a cart in that region.

The TaxRate data model has a rate property that represents the percentage amount. For example, a rate of 10 means a tax rate of 10%.

Combinable Tax Rates#

Tax regions can have parent tax regions. To inherit the tax rates of the parent tax region, set the is_combinable of the child’s tax rates to true.

Then, when tax rates are retrieved for a taxable item in the child region, both the child and the parent tax regions’ applicable rates are returned.


Override Tax Rates with Rules#

You can create tax rates that override the default for specific conditions or rules.

For example, you can have a default 10% tax rate, but for products of type “Shirt” it is 15%.

A tax region can have multiple tax rates, and each tax rate can have multiple tax rules. The TaxRateRule data model represents a tax rate’s rule.

A diagram showcasing the relation between TaxRegion, TaxRate, and TaxRateRule

The following two properties of the data model identify the rule’s target:

  • reference: the name of the table in the database that this rule points to. For example, product_type.
  • reference_id: the ID of the data model’s record that this points to. For example, a product type’s ID.

So, to override the default tax rate for product types “Shirt”, you create a tax rate and associate with it a tax rule whose reference is product_type and reference_id the ID of the “Shirt” product type.

Was this page helpful?
Ask Anything
Ask any questions about Medusa. Get help with your development.
You can also use the Medusa MCP server in Cursor, VSCode, etc...
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break