@medusajs/region
Documentation | Website
Building blocks for digital commerce
Region Module for Medusa: manages regions and the countries that belong to them. Use it to define the markets you sell in, each with its own currency and set of countries. It ships with @medusajs/medusa and is registered by default, so Medusa applications don't install it directly.
At a glance
| Package | @medusajs/region |
| Type | Commerce Module |
| Module key | Modules.REGION ("region") |
| Registered by default | Yes |
| Import from | @medusajs/medusa/region |
Features
- Create regions with a currency and a list of countries.
- Toggle automatic tax calculation per region.
- Loads the list of countries into the database when the application starts.
Installation
No installation needed. The module is included in @medusajs/medusa and registered by default.
Usage
Resolve the module's service from the container, for example in a workflow step:
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { Modules } from "@medusajs/framework/utils"
const createRegionStep = createStep(
"create-region",
async ({}, { container }) => {
const regionModuleService = container.resolve(Modules.REGION)
const region = await regionModuleService.createRegions({
name: "Europe",
currency_code: "eur",
})
return new StepResponse({ region }, region.id)
}
)