From d8c65a731025e52a7f0b27e4689f9af323d01a49 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 11 Sep 2025 14:41:43 +0300 Subject: [PATCH] docs: add section on multi-currency and region support --- www/apps/book/public/llms-full.txt | 57 ++++++++++++++++++ .../pricing/concepts/page.mdx | 58 ++++++++++++++++++- .../app/commerce-modules/pricing/page.mdx | 1 + www/apps/resources/generated/edit-dates.mjs | 4 +- 4 files changed, 117 insertions(+), 3 deletions(-) diff --git a/www/apps/book/public/llms-full.txt b/www/apps/book/public/llms-full.txt index aebbcc8862..a52df4f27c 100644 --- a/www/apps/book/public/llms-full.txt +++ b/www/apps/book/public/llms-full.txt @@ -32568,6 +32568,62 @@ A price list has optional `start_date` and `end_date` properties that indicate t Its associated prices are represented by the [Price data model](#price-data-model). +*** + +## Multi-Currency Support for Prices + +The `Price` data model has a `currency_code` property that represents the currency of the price. For example, `usd` for US Dollars and `eur` for Euros. + +This adds support for multi-currency pricing, allowing you to associate a resource with a price set that contains prices in multiple currencies. + +For example, Medusa links a product variant from the [Product Module](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/product/index.html.md) to a price set that contains prices in multiple currencies. A variant's price set would be similar to the following: + +```json title="Example Price Set with Multiple Currencies" +{ + "id": "pset_123", + "prices": [ + { + "id": "price_123", + "amount": 20, + "currency_code": "usd" + }, + { + "id": "price_124", + "amount": 18, + "currency_code": "eur" + } + ] +} +``` + +When the customer views and purchases a product, Medusa selects the price based on the customer's currency. + +*** + +## Multi-Region Support for Prices + +The `Price` data model has a relation to the [PriceRule](https://docs.medusajs.com/references/pricing/models/PriceRule/index.html.md) data model that allows you to define prices that are applied based on specific conditions, such as the customer's region. + +For example, Medusa allows you to specify prices for a product variant that are applied only when the customer is in a specific region. The price would be similar to the following: + +```json title="Example Price with Region Rule" +{ + "id": "price_123", + "amount": 25, + "currency_code": "usd", + "price_rules": [ + { + "id": "pricerule_123", + "attribute": "region_id", + "value": "reg_123", + "operator": "eq" + } + ] +} +``` + +When the customer views and purchases a product, Medusa selects the price based on the customer's region. + # Links between Pricing Module and Other Modules @@ -32766,6 +32822,7 @@ Learn more about why modules are isolated in [this documentation](https://docs.m ## Pricing Features - [Price Management](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/pricing/concepts/index.html.md): Store and manage prices of a resource, such as a product or a variant. +- [Multi-Currency and Region Support](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/pricing/concepts#multi-currency-support-for-prices/index.html.md): Define prices for a single resource in multiple currencies and regions. - [Advanced Rule Engine](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/pricing/price-rules/index.html.md): Create prices with tiers and custom rules to condition prices based on different contexts. - [Price Lists](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/pricing/concepts#price-list/index.html.md): Group prices and apply them only in specific conditions with price lists. - [Price Calculation Strategy](https://docs.medusajs.com/Users/shahednasser/medusa/www/apps/resources/app/commerce-modules/pricing/price-calculation/index.html.md): Retrieve the best price in a given context and for the specified rule values. diff --git a/www/apps/resources/app/commerce-modules/pricing/concepts/page.mdx b/www/apps/resources/app/commerce-modules/pricing/concepts/page.mdx index b84abb285c..206212d9fb 100644 --- a/www/apps/resources/app/commerce-modules/pricing/concepts/page.mdx +++ b/www/apps/resources/app/commerce-modules/pricing/concepts/page.mdx @@ -34,4 +34,60 @@ When the conditions are met, the prices in the price list can override the defau A price list has optional `start_date` and `end_date` properties that indicate the date range in which a price list can be applied. -Its associated prices are represented by the [Price data model](#price-data-model). \ No newline at end of file +Its associated prices are represented by the [Price data model](#price-data-model). + +--- + +## Multi-Currency Support for Prices + +The `Price` data model has a `currency_code` property that represents the currency of the price. For example, `usd` for US Dollars and `eur` for Euros. + +This adds support for multi-currency pricing, allowing you to associate a resource with a price set that contains prices in multiple currencies. + +For example, Medusa links a product variant from the [Product Module](../../product/page.mdx) to a price set that contains prices in multiple currencies. A variant's price set would be similar to the following: + +```json title="Example Price Set with Multiple Currencies" +{ + "id": "pset_123", + "prices": [ + { + "id": "price_123", + "amount": 20, + "currency_code": "usd" + }, + { + "id": "price_124", + "amount": 18, + "currency_code": "eur" + } + ] +} +``` + +When the customer views and purchases a product, Medusa selects the price based on the customer's currency. + +--- + +## Multi-Region Support for Prices + +The `Price` data model has a relation to the [PriceRule](/references/pricing/models/PriceRule) data model that allows you to define prices that are applied based on specific conditions, such as the customer's region. + +For example, Medusa allows you to specify prices for a product variant that are applied only when the customer is in a specific region. The price would be similar to the following: + +```json title="Example Price with Region Rule" +{ + "id": "price_123", + "amount": 25, + "currency_code": "usd", + "price_rules": [ + { + "id": "pricerule_123", + "attribute": "region_id", + "value": "reg_123", + "operator": "eq" + } + ] +} +``` + +When the customer views and purchases a product, Medusa selects the price based on the customer's region. \ No newline at end of file diff --git a/www/apps/resources/app/commerce-modules/pricing/page.mdx b/www/apps/resources/app/commerce-modules/pricing/page.mdx index 6089449715..fd93283286 100644 --- a/www/apps/resources/app/commerce-modules/pricing/page.mdx +++ b/www/apps/resources/app/commerce-modules/pricing/page.mdx @@ -29,6 +29,7 @@ Learn more about why modules are isolated in [this documentation](!docs!/learn/f ## Pricing Features - [Price Management](./concepts/page.mdx): Store and manage prices of a resource, such as a product or a variant. +- [Multi-Currency and Region Support](./concepts/page.mdx#multi-currency-support-for-prices): Define prices for a single resource in multiple currencies and regions. - [Advanced Rule Engine](./price-rules/page.mdx): Create prices with tiers and custom rules to condition prices based on different contexts. - [Price Lists](./concepts/page.mdx#price-list): Group prices and apply them only in specific conditions with price lists. - [Price Calculation Strategy](./price-calculation/page.mdx): Retrieve the best price in a given context and for the specified rule values. diff --git a/www/apps/resources/generated/edit-dates.mjs b/www/apps/resources/generated/edit-dates.mjs index e514f9bfb5..21a5cf4966 100644 --- a/www/apps/resources/generated/edit-dates.mjs +++ b/www/apps/resources/generated/edit-dates.mjs @@ -55,11 +55,11 @@ export const generatedEditDates = { "app/commerce-modules/payment/page.mdx": "2025-04-17T08:48:11.702Z", "app/commerce-modules/pricing/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/pricing/_events/page.mdx": "2024-07-03T19:27:13+03:00", - "app/commerce-modules/pricing/concepts/page.mdx": "2025-09-05T07:49:40.703Z", + "app/commerce-modules/pricing/concepts/page.mdx": "2025-09-11T11:39:20.879Z", "app/commerce-modules/pricing/price-calculation/page.mdx": "2025-09-05T07:54:21.322Z", "app/commerce-modules/pricing/price-rules/page.mdx": "2025-06-10T15:56:43.648Z", "app/commerce-modules/pricing/tax-inclusive-pricing/page.mdx": "2025-06-27T15:43:35.193Z", - "app/commerce-modules/pricing/page.mdx": "2025-05-20T07:51:40.710Z", + "app/commerce-modules/pricing/page.mdx": "2025-09-11T11:39:53.831Z", "app/commerce-modules/product/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/product/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/product/guides/price/page.mdx": "2024-12-25T15:10:37.730Z",