---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# PricingService
Allows retrieval of prices.
## Constructors
#### constructor
`**new PricingService**(«destructured»)`
##### Parameters
## Properties
`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customerService_",
"type": "[CustomerService](CustomerService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "featureFlagRouter",
"type": "[FlagRouter](FlagRouter.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "EntityManager",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "priceSelectionStrategy",
"type": "[IPriceSelectionStrategy](../interfaces/IPriceSelectionStrategy.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "productVariantService",
"type": "[ProductVariantService](ProductVariantService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "regionService",
"type": "[RegionService](RegionService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "taxProviderService",
"type": "[TaxProviderService](TaxProviderService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| EntityManager",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Accessors
#### activeManager\_
`Protected` **activeManager\_**: [object Object]
___
#### pricingModuleService
`Protected` **pricingModuleService**: [object Object]
___
#### remoteQuery
`Protected` **remoteQuery**: [object Object]
## Methods
#### atomicPhase\_
`Protected **atomicPhase_**(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>`
Wraps some work within a transactional block. If the service already has
a transaction manager attached this will be reused, otherwise a new
transaction manager is created.
##### Type Parameters
##### Parameters
Promise<TResult>",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => Promise<void \\| TResult>",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
Promise<TResult>
___
#### calculateTaxes
`**calculateTaxes**(variantPricing, productRates): [TaxedPricing](../types/TaxedPricing.mdx)`
Gets the prices for a product variant
##### Parameters
##### Returns
[TaxedPricing](../types/TaxedPricing.mdx)
___
#### collectPricingContext
`**collectPricingContext**(context): Promise<[PricingContext](../types/PricingContext-1.mdx)>`
Collects additional information necessary for completing the price
selection.
##### Parameters
##### Returns
Promise<[PricingContext](../types/PricingContext-1.mdx)>
___
#### getPricingModuleVariantMoneyAmounts
`Private **getPricingModuleVariantMoneyAmounts**(variantIds): Promise<Map<string, [MoneyAmount](MoneyAmount.mdx)[]>>`
##### Parameters
##### Returns
Promise<Map<string, [MoneyAmount](MoneyAmount.mdx)[]>>
___
#### getProductPricing
`**getProductPricing**(product, context): Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>`
Gets all the variant prices for a product. All the product's variants will
be fetched.
##### Parameters
##### Returns
Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>
___
#### getProductPricingById
`**getProductPricingById**(productId, context): Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>`
Gets all the variant prices for a product by the product id
##### Parameters
##### Returns
Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>
___
#### getProductPricing\_
`Private **getProductPricing_**(data, context): Promise<Map<string, Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>>`
##### Parameters
##### Returns
Promise<Map<string, Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>>
___
#### getProductVariantPricing
`**getProductVariantPricing**(variant, context): Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>`
Gets the prices for a product variant.
##### Parameters
##### Returns
Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>
___
#### getProductVariantPricingById
`**getProductVariantPricingById**(variantId, context): Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>`
Gets the prices for a product variant by a variant id.
##### Parameters
##### Returns
Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>
#### Deprecated
Use [getProductVariantsPricing](PricingService.mdx#getproductvariantspricing) instead.
___
#### getProductVariantPricingModulePricing\_
`Private **getProductVariantPricingModulePricing_**(variantPriceData, context): Promise<Map<any, any>>`
##### Parameters
##### Returns
Promise<Map<any, any>>
___
#### getProductVariantPricing\_
`Private **getProductVariantPricing_**(data, context): Promise<Map<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>`
##### Parameters
##### Returns
Promise<Map<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>
___
#### getProductVariantsPricing
`**getProductVariantsPricing**(data, context): Promise<{ [variant_id: string]: [ProductVariantPricing](../types/ProductVariantPricing.mdx); }>`
Gets the prices for a collection of variants.
##### Parameters
##### Returns
Promise<{ [variant_id: string]: [ProductVariantPricing](../types/ProductVariantPricing.mdx); }>
___
#### getShippingOptionPricing
`**getShippingOptionPricing**(shippingOption, context): Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)>`
Gets the prices for a shipping option.
##### Parameters
##### Returns
Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)>
___
#### setAdminProductPricing
`**setAdminProductPricing**(products): Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>`
##### Parameters
##### Returns
Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>
___
#### setAdminVariantPricing
`**setAdminVariantPricing**(variants, context?): Promise<[PricedVariant](../types/PricedVariant.mdx)[]>`
##### Parameters
##### Returns
Promise<[PricedVariant](../types/PricedVariant.mdx)[]>
___
#### setProductPrices
`**setProductPrices**(products, context?): Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>`
Set additional prices on a list of products.
##### Parameters
##### Returns
Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>
___
#### setShippingOptionPrices
`**setShippingOptionPrices**(shippingOptions, context?): Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)[]>`
Set additional prices on a list of shipping options.
##### Parameters
##### Returns
Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)[]>
___
#### setVariantPrices
`**setVariantPrices**(variants, context?): Promise<[PricedVariant](../types/PricedVariant.mdx)[]>`
Set additional prices on a list of product variants.
##### Parameters
##### Returns
Promise<[PricedVariant](../types/PricedVariant.mdx)[]>
___
#### shouldRetryTransaction\_
`Protected **shouldRetryTransaction_**(err): boolean`
##### Parameters
` \\| ``{ code: string }``",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
##### Returns
`boolean`
___
#### withTransaction
`**withTransaction**(transactionManager?): [PricingService](PricingService.mdx)`
##### Parameters
##### Returns
[PricingService](PricingService.mdx)