Skip to main content
Skip to main content

createRuleTypes - Pricing Module Reference

Beta

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

This method is used to create new rule types.

Example

import {
initialize as initializePricingModule,
} from "@medusajs/pricing"

async function createRuleTypes () {
const pricingService = await initializePricingModule()

const ruleTypes = await pricingService.createRuleTypes([
{
name: "Region",
rule_attribute: "region_id"
}
])

// do something with the rule types or return them
}

Parameters

dataCreateRuleTypeDTO[]Required
The rule types to create.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<RuleTypeDTO[]>Required
The list of created rule types.
Was this section helpful?