Skip to main content
Skip to main content

retrievePriceList - Pricing Module Reference

Beta

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

This method is used to retrieve a price list by its ID.

Example

A simple example that retrieves a price list by its ID:

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

async function retrievePriceList (priceListId: string) {
const pricingService = await initializePricingModule()

const priceList = await pricingService.retrievePriceList(
priceListId
)

// do something with the price list or return it
}

To specify relations that should be retrieved:

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

async function retrievePriceList (priceListId: string) {
const pricingService = await initializePricingModule()

const priceList = await pricingService.retrievePriceList(
priceListId,
{
relations: ["price_set_money_amounts"]
}
)

// do something with the price list or return it
}

Parameters

idstringRequired
The ID of the price list to retrieve.
The configurations determining how the price list is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a price list.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<PriceListDTO>Required
The retrieved price list.
Was this section helpful?