Skip to main content
Skip to main content

retrieve - Pricing Module Reference

Beta

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

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

Example

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

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

async function retrievePriceSet (priceSetId: string) {
const pricingService = await initializePricingModule()

const priceSet = await pricingService.retrieve(
priceSetId
)

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

To specify relations that should be retrieved:

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

async function retrievePriceSet (priceSetId: string) {
const pricingService = await initializePricingModule()

const priceSet = await pricingService.retrieve(
priceSetId,
{
relations: ["money_amounts"]
}
)

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

Parameters

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

Returns

PromisePromise<PriceSetDTO>Required
The retrieved price set.
Was this section helpful?