Tax Lines in Order Module

In this document, you’ll learn about tax lines in an order.

What are Tax Lines?#

A tax line indicates the tax rate of a line item or a shipping method.

The OrderLineItemTaxLine data model represents a line item’s tax line, and the OrderShippingMethodTaxLine data model represents a shipping method’s tax line.

A diagram showcasing the relation between orders, items and shipping methods, and tax lines


Tax Inclusivity#

By default, the tax amount is calculated by taking the tax rate from the line item or shipping method’s amount and then adding it to the item/method’s subtotal.

However, line items and shipping methods have an is_tax_inclusive property that, when enabled, indicates that the item or method’s price already includes taxes.

So, instead of calculating the tax rate and adding it to the item/method’s subtotal, it’s calculated as part of the subtotal.

Note: The following diagram is a simplified showcase of how a subtotal is calculated from the tax perspective.

A diagram showcasing how a subtotal is calculated from the tax perspective

For example, if a line item's amount is 5000, the tax rate is 10, and is_tax_inclusive is enabled, the tax amount is 10% of 5000, which is 500. The item's unit price becomes 4500.

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