PricingService
Allows retrieval of prices.
constructor
Parameters
__namedParametersInjectedDependenciesRequiredProperties
__container__anyRequiredfeatureFlagRouterFlagRouterRequiredmanager_EntityManagerRequiredtransactionManager_undefined | EntityManagerRequired__configModule__Record<string, unknown>__moduleDeclaration__Record<string, unknown>Accessors
activeManager_
Returns
EntityManagerEntityManagerRequiredpricingModuleService
Returns
IPricingModuleServiceobjectRequiredremoteQuery
Returns
RemoteQueryFunction(query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any> | nullRequiredMethods
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.
Type Parameters
TResultobjectRequiredTErrorobjectRequiredParameters
work(transactionManager: EntityManager) => Promise<TResult>Requiredthe 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>Requiredthe result of the transactional work
calculateTaxes
Gets the prices for a product variant
Parameters
the prices retrieved from a variant
the tax rates that the product has applied
Returns
TaxedPricingobjectRequiredPricing fields related to taxes.
collectPricingContext
Collects additional information necessary for completing the price selection.
Parameters
the price selection context to use
Returns
PromisePromise<PricingContext>RequiredThe pricing context
getPricingModuleVariantMoneyAmounts
Parameters
variantIdsstring[]RequiredReturns
getProductPricing
Gets all the variant prices for a product. All the product's variants will be fetched.
Parameters
the product to get pricing for.
the price selection context to use
Returns
A map of variant ids to their corresponding prices
getProductPricingById
Gets all the variant prices for a product by the product id
Parameters
productIdstringRequiredthe id of the product to get prices for
the price selection context to use
Returns
A map of variant ids to their corresponding prices
getProductPricing_
Parameters
dataobject[]RequiredReturns
getProductVariantPricing
Gets the prices for a product variant.
Parameters
the price selection context to use
Returns
The product variant prices
getProductVariantPricingById
Gets the prices for a product variant by a variant id.
Parameters
variantIdstringRequiredthe id of the variant to get prices for
the price selection context to use
Returns
The product variant prices
Deprecated
Use getProductVariantsPricing instead.
getProductVariantPricingModulePricing_
Parameters
variantPriceDataobject[]RequiredReturns
PromisePromise<Map<any, any>>RequiredgetProductVariantPricing_
Parameters
dataobject[]RequiredReturns
getProductVariantsPricing
Gets the prices for a collection of variants.
Parameters
dataobject[]Requiredthe price selection context to use
Returns
PromisePromise<object>RequiredThe product variant prices
getShippingOptionPricing
Gets the prices for a shipping option.