retrieveRuleType - Pricing Module Reference
BetaThis documentation provides a reference to the retrieveRuleType
method. This belongs to the Pricing Module.
This method is used to retrieve a rule type by its ID and and optionally based on the provided configurations.
Example
A simple example that retrieves a rule type by its code:
To specify attributes that should be retrieved:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrieveRuleType (ruleTypeId: string) {
const pricingService = await initializePricingModule()
const ruleType = await pricingService.retrieveRuleType(ruleTypeId, {
select: ["name"]
})
// do something with the rule type or return it
}
Parameters
id
stringRequiredThe ID of the rule type to retrieve.
config
FindConfig<RuleTypeDTO>The configurations determining how the rule type is retrieved. Its properties, such as select
or relations
, accept the
attributes or relations associated with a rule type.
config
FindConfig<RuleTypeDTO>select
or relations
, accept the
attributes or relations associated with a rule type.sharedContext
ContextA context used to share resources, such as transaction manager, between the application and the module.
sharedContext
ContextReturns
The retrieved rule type.
Was this section helpful?