Skip to main content
Skip to main content

addRules - Pricing Module Reference

This documentation provides a reference to the addRules method. This belongs to the Pricing Module.

addRules(data, sharedContext?): Promise<PriceSetDTO>

This method adds rules to a price set.

Example

const priceSet = await pricingModuleService.addRules({
priceSetId: "pset_123",
rules: [
{
attribute: "region_id",
},
],
})

Parameters

dataAddRulesDTORequired
The data defining the price set to add the rules to, along with the rules to add.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<PriceSetDTO>Required
The price set that the rules were added to.

addRules(data, sharedContext?): Promise<PriceSetDTO[]>

This method adds rules to multiple price sets.

Example

const priceSets = await pricingModuleService.addRules([
{
priceSetId: "pset_123",
rules: [
{
attribute: "region_id",
},
],
},
{
priceSetId: "pset_321",
rules: [
{
attribute: "customer_group_id",
},
],
},
])

Parameters

dataAddRulesDTO[]Required
The data defining the rules to add per price set.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<PriceSetDTO[]>Required
The list of the price sets that the rules were added to.
Was this section helpful?