Skip to main content
Skip to main content

PricingService

Allows retrieval of prices.

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
customerService_CustomerServiceRequired
featureFlagRouterFlagRouterRequired
getPricingModuleVariantMoneyAmountsanyRequired
getProductPricing_anyRequired
getProductVariantPricingModulePricing_anyRequired
getProductVariantPricing_anyRequired
manager_EntityManagerRequired
priceSelectionStrategyIPriceSelectionStrategyRequired
productVariantServiceProductVariantServiceRequired
regionServiceRegionServiceRequired
taxProviderServiceTaxProviderServiceRequired
transactionManager_undefined | EntityManagerRequired

Accessors

activeManager_

Inherited from

TransactionBaseService.activeManager_


pricingModuleService


remoteQuery

Methods

atomicPhase_

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.

Parameters
work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler
Returns
PromisePromise<TResult>Required
the result of the transactional work

calculateTaxes

Gets the prices for a product variant

Parameters
variantPricingProductVariantPricingRequired
the prices retrieved from a variant
productRatesTaxServiceRate[]Required
the tax rates that the product has applied
Returns
TaxedPricingobjectRequired
Pricing fields related to taxes.

collectPricingContext

Collects additional information necessary for completing the price selection.

Parameters
contextPriceSelectionContextRequired
the price selection context to use
Returns
PromisePromise<PricingContext>Required
The pricing context

getProductPricing

Gets all the variant prices for a product. All the product's variants will be fetched.

Parameters
productPick<Product, "id" | "variants">Required
the product to get pricing for.
contextPriceSelectionContextRequired
the price selection context to use
Returns
PromisePromise<Record<string, ProductVariantPricing>>Required
A map of variant ids to their corresponding prices

getProductPricingById

Gets all the variant prices for a product by the product id

Parameters
productIdstringRequired
the id of the product to get prices for
contextPriceSelectionContextRequired
the price selection context to use
Returns
PromisePromise<Record<string, ProductVariantPricing>>Required
A map of variant ids to their corresponding prices

getProductVariantPricing

Gets the prices for a product variant.

Parameters
variantPick<ProductVariant, "product_id" | "id">Required
the price selection context to use
Returns
PromisePromise<ProductVariantPricing>Required
The product variant prices

getProductVariantPricingById

Gets the prices for a product variant by a variant id.

Parameters
variantIdstringRequired
the id of the variant to get prices for
the price selection context to use
Returns
PromisePromise<ProductVariantPricing>Required
The product variant prices

Deprecated

Use getProductVariantsPricing instead.


getProductVariantsPricing

Gets the prices for a collection of variants.

Parameters
data{ quantity?: number ; variantId: string }[]Required
the price selection context to use
Returns
PromisePromise<{ [variant_id: string]: ProductVariantPricing; }>Required
The product variant prices

getShippingOptionPricing

Gets the prices for a shipping option.

Parameters
shippingOptionShippingOptionRequired
the shipping option to get prices for
the price selection context to use
Returns
PromisePromise<PricedShippingOption>Required
The shipping option prices

setAdminProductPricing

Parameters
productsProduct[]Required
Returns
PromisePromise<(Product | PricedProduct)[]>Required

setAdminVariantPricing

Parameters
variantsProductVariant[]Required
Returns
PromisePromise<PricedVariant[]>Required

setProductPrices

Set additional prices on a list of products.

Parameters
productsProduct[]Required
list of products on which to set additional prices
the price selection context to use
Returns
PromisePromise<(Product | PricedProduct)[]>Required
A list of products with variants decorated with prices

setShippingOptionPrices

Set additional prices on a list of shipping options.

Parameters
shippingOptionsShippingOption[]Required
list of shipping options on which to set additional prices
contextOmit<PriceSelectionContext, "region_id">
the price selection context to use
Returns
PromisePromise<PricedShippingOption[]>Required
A list of shipping options with prices

setVariantPrices

Set additional prices on a list of product variants.

Parameters
variantsProductVariant[]Required
the price selection context to use
Returns
PromisePromise<PricedVariant[]>Required
A list of products with variants decorated with prices

shouldRetryTransaction_

Parameters
errRecord<string, unknown> | { code: string }Required
Returns
booleanboolean

withTransaction

Parameters
transactionManagerEntityManager
Returns
PricingServicePricingServiceRequired
Was this section helpful?