@medusajs/tax
v2.22.4
Published
Medusa Tax module
Keywords
Readme
Tax Module for Medusa: manages tax regions, tax rates, tax rate rules, and tax providers, and calculates tax lines for carts and orders. Tax calculation is delegated to Tax Module Providers: the built-in system provider (tp_system) is always available, and you can register custom or third-party providers (for example, to integrate a tax service) through the module's providers option. It's installed and registered by default with @medusajs/medusa.
At a glance
| | |
| --- | --- |
| Package | @medusajs/tax |
| Type | Commerce Module |
| Module key | Modules.TAX ("tax") |
| Registered by default | Yes |
| Import from | @medusajs/medusa/tax |
Installation
No installation needed. The module ships with @medusajs/medusa and is registered by defineConfig.
Usage
To register a custom tax provider, add it to the module's providers option in medusa-config.ts:
import { defineConfig } from "@medusajs/framework/utils"
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/tax",
options: {
providers: [
{
resolve: "./src/modules/my-tax-provider",
id: "my-provider",
},
],
},
},
],
})The registered provider's ID has the format tp_{identifier}_{id}, where identifier is the provider class's static identifier property and id is the id set above. Assign it to a tax region to use it for that region's tax calculations.
Configuration
| Option | Type | Description | Default |
| --- | --- | --- | --- |
| providers | { resolve: string, id?: string, options?: Record<string, unknown> }[] | Tax Module Providers to register in addition to the built-in system provider. | [] |
