Skip to main content
Skip to main content

RegionsResource

This class is used to send requests to Store Region API Routes. All its method are available in the JS Client under the medusa.regions property.

Regions are different countries or geographical regions that the commerce store serves customers in. Customers can choose what region they're in, which can be used to change the prices shown based on the region and its currency.

Related Guide: How to use regions in a storefront

Methods

list

Retrieve a list of regions. This method is useful to show the customer all available regions to choose from.

Example
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.regions.list().then(({ regions, count, limit, offset }) => {
console.log(regions.length)
})
Parameters
customHeadersRecord<string, any>Required
Custom headers to attach to the request.

Default: {}

Returns
ResponsePromiseResponsePromise<StoreRegionsListRes>Required
Resolves to the list of regions with pagination fields.

retrieve

Retrieve a Region's details.

Example
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.regions.retrieve(regionId).then(({ region }) => {
console.log(region.id)
})
Parameters
idstringRequired
The region's ID.
customHeadersRecord<string, any>Required
Custom headers to attach to the request.

Default: {}

Returns
ResponsePromiseResponsePromise<StoreRegionsRes>Required
Resolves to the region's details.
Was this section helpful?