Loading...
Was this page helpful?
This documentation provides a reference to the createPriceSets
method. This belongs to the Pricing Module.
This method is used to create a new price set.
To create a default price set, don't pass any rules. For example:
To create a price set and associate it with rule types:
1const priceSet = await pricingModuleService.createPriceSets({2 prices: [3 {4 amount: 300,5 currency_code: "EUR",6 rules: {7 region_id: "PL",8 city: "krakow",9 },10 },11 {12 amount: 400,13 currency_code: "EUR",14 rules: {15 region_id: "PL",16 },17 },18 {19 amount: 450,20 currency_code: "EUR",21 rules: {22 city: "krakow",23 },24 },25 ],26})
Promise
Promise<PriceSetDTO>This method is used to create multiple price sets.
1const priceSets = await pricingModuleService.createPriceSets([2 // default price set3 {4 rules: [],5 prices: [6 {7 amount: 500,8 currency_code: "USD",9 min_quantity: 0,10 max_quantity: 4,11 rules: {},12 },13 {14 amount: 400,15 currency_code: "USD",16 min_quantity: 5,17 max_quantity: 10,18 rules: {},19 },20 ],21 },22 // price set with rules23 {24 prices: [25 {26 amount: 300,27 currency_code: "EUR",28 rules: {29 region_id: "PL",30 city: "krakow",31 },32 },33 {34 amount: 400,35 currency_code: "EUR",36 rules: {37 region_id: "PL",38 },39 },40 {41 amount: 450,42 currency_code: "EUR",43 rules: {44 city: "krakow",45 },46 },47 ],48 },49])
data
CreatePriceSetDTO[]Promise
Promise<PriceSetDTO[]>