Loading...
Was this page helpful?
This documentation provides a reference to the addPrices
method. This belongs to the Pricing Module.
This method adds prices to a price set.
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})
data
AddPricesDTOPromise
Promise<PriceSetDTO>This method adds prices to multiple price sets.
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])
data
AddPricesDTO[]Promise
Promise<PriceSetDTO[]>