- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Pricing Module
The Pricing Module provides pricing-related features in your Medusa and Node.js applications.
How to Use Pricing Module's Service#
You can use the Pricing Module's main service by resolving from the Medusa container the resource Modules.PRICING
imported from @medusajs/framework/utils
.
For example:
Features#
Price Management#
Store the prices of a resource and manage them through the main service's methods.
Prices are grouped in a price set, allowing you to add more than one price for a resource based on different conditions, such as currency code.
Advanced Rule Engine#
Create prices with custom rules. This gives you more flexibility in how you condition prices, filter them, and ensure the best prices are retrieved for custom contexts.
Price Lists#
Group prices and apply them only in specific conditions with price lists.
You can also use them to override existing prices for specified conditions, or create a sale.
1const priceList = await pricingModuleService.createPriceLists([2 {3 title: "My Sale",4 description: "Sale on selected items.",5 type: "sale",6 starts_at: Date.parse("01/10/2023").toString(),7 ends_at: Date.parse("31/10/2023").toString(),8 rules: {9 region_id: ["reg_123", "reg_321"],10 },11 prices: [12 {13 amount: 400,14 currency_code: "EUR",15 price_set_id: "pset_123",16 },17 ],18 },19])
Price Calculation Strategy#
Retrieve the best price in a given context and for the specified rule values.