- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- User Guide
addPrices - Pricing Module Reference
This documentation provides a reference to the addPrices
method. This belongs to the Pricing Module.
Note: You should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.
addPrices(data, sharedContext?): Promise<PriceSetDTO>#
This method adds prices to a price set.
Example#
To add a default price to a price set, don't pass it any rules and make sure to pass it the currency_code
:
To add prices with rules:
1const priceSet = await pricingModuleService.addPrices({2 priceSetId: "pset_123",3 prices: [4 {5 amount: 300,6 currency_code: "EUR",7 rules: {8 region_id: "PL",9 city: "krakow",10 },11 },12 {13 amount: 400,14 currency_code: "EUR",15 min_quantity: 0,16 max_quantity: 4,17 rules: {18 region_id: "PL",19 },20 },21 {22 amount: 450,23 currency_code: "EUR",24 rules: {25 city: "krakow",26 },27 },28 ],29})
Parameters#
data
AddPricesDTOThe data defining the price set to add the prices to, along with the prices to add.
data
AddPricesDTOReturns#
Promise
Promise<PriceSetDTO>The price set that the prices were added to.
Promise
Promise<PriceSetDTO>addPrices(data, sharedContext?): Promise<PriceSetDTO[]>#
This method adds prices to multiple price sets.
Example#
1const priceSets = await pricingModuleService.addPrices([2 {3 priceSetId: "pset_123",4 prices: [5 // default price because it doesn't6 // have rules7 {8 amount: 500,9 currency_code: "USD",10 rules: {},11 },12 ],13 },14 {15 priceSetId: "pset_321",16 prices: [17 // prices with rules18 {19 amount: 300,20 currency_code: "EUR",21 rules: {22 region_id: "PL",23 city: "krakow",24 },25 },26 ],27 },28])
Parameters#
data
AddPricesDTO[]The data defining the prices to add per price set.
data
AddPricesDTO[]Returns#
Promise
Promise<PriceSetDTO[]>The list of the price sets that prices were added to.
Promise
Promise<PriceSetDTO[]>Was this page helpful?