retrievePriceListRule - Pricing Module Reference
BetaThis documentation provides a reference to the retrievePriceListRule
method. This belongs to the Pricing Module.
This method is used to retrieve a price list rule by its ID.
Example
A simple example that retrieves a price list rule by its ID:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceListRule (priceListRuleId: string) {
const pricingService = await initializePricingModule()
const priceListRule = await pricingService.retrievePriceListRule(
priceListRuleId
)
// do something with the price list rule or return it
}
To specify relations that should be retrieved:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceListRule (priceListRuleId: string) {
const pricingService = await initializePricingModule()
const priceListRule = await pricingService.retrievePriceListRule(
priceListRuleId,
{
relations: ["price_list"]
}
)
// do something with the price list rule or return it
}
Parameters
id
stringRequiredThe ID of the price list rule to retrieve.
config
FindConfig<PriceListRuleDTO>The configurations determining how the price list rule is retrieved. Its properties, such as select
or relations
, accept the
attributes or relations associated with a price list rule.
config
FindConfig<PriceListRuleDTO>select
or relations
, accept the
attributes or relations associated with a price list rule.Returns
The retrieved price list rule.
Was this section helpful?