Generated the following references: - `entities` - `inventory` - `js-client` - `pricing` - `product` - `services` - `stock-location` - `workflows` Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
1071 lines
24 KiB
Plaintext
1071 lines
24 KiB
Plaintext
---
|
|
displayed_sidebar: servicesSidebar
|
|
---
|
|
|
|
import ParameterTypes from "@site/src/components/ParameterTypes"
|
|
|
|
# PricingService
|
|
|
|
Allows retrieval of prices.
|
|
|
|
## Constructors
|
|
|
|
#### constructor
|
|
|
|
`**new PricingService**(«destructured»)`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "__namedParameters",
|
|
"type": "[InjectedDependencies](../types/InjectedDependencies-25.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
## Properties
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "__configModule__",
|
|
"type": "`Record<string, unknown>`",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "__container__",
|
|
"type": "`any`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "__moduleDeclaration__",
|
|
"type": "`Record<string, unknown>`",
|
|
"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_**<TypeParameter TResult, TypeParameter TError>(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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "TResult",
|
|
"type": "`object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "TError",
|
|
"type": "`object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "work",
|
|
"type": "(`transactionManager`: EntityManager) => 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>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<TResult>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the transactional work",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### calculateTaxes
|
|
|
|
`**calculateTaxes**(variantPricing, productRates): [TaxedPricing](../types/TaxedPricing.mdx)`
|
|
|
|
Gets the prices for a product variant
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variantPricing",
|
|
"type": "[ProductVariantPricing](../types/ProductVariantPricing.mdx)",
|
|
"description": "the prices retrieved from a variant",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "productRates",
|
|
"type": "[TaxServiceRate](../types/TaxServiceRate.mdx)[]",
|
|
"description": "the tax rates that the product has applied",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
[TaxedPricing](../types/TaxedPricing.mdx)
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "TaxedPricing",
|
|
"type": "`object`",
|
|
"description": "Pricing fields related to taxes.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### collectPricingContext
|
|
|
|
`**collectPricingContext**(context): Promise<[PricingContext](../types/PricingContext-1.mdx)>`
|
|
|
|
Collects additional information necessary for completing the price
|
|
selection.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[PricingContext](../types/PricingContext-1.mdx)>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[PricingContext](../types/PricingContext-1.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "The pricing context",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getPricingModuleVariantMoneyAmounts
|
|
|
|
`Private **getPricingModuleVariantMoneyAmounts**(variantIds): Promise<Map<string, [MoneyAmount](MoneyAmount.mdx)[]>>`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variantIds",
|
|
"type": "`string`[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Map<string, [MoneyAmount](MoneyAmount.mdx)[]>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Map<string, [MoneyAmount](MoneyAmount.mdx)[]>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### 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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "product",
|
|
"type": "[Pick](../types/Pick.mdx)<[Product](Product.mdx), \"id\" \\| \"variants\">",
|
|
"description": "the product to get pricing for.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "A map of variant ids to their corresponding prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getProductPricingById
|
|
|
|
`**getProductPricingById**(productId, context): Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>`
|
|
|
|
Gets all the variant prices for a product by the product id
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "productId",
|
|
"type": "`string`",
|
|
"description": "the id of the product to get prices for",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "A map of variant ids to their corresponding prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getProductPricing\_
|
|
|
|
`Private **getProductPricing_**(data, context): Promise<Map<string, Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>>`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "data",
|
|
"type": "``{ productId: string ; variants: [ProductVariant](ProductVariant.mdx)[] }``[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Map<string, Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Map<string, Record<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getProductVariantPricing
|
|
|
|
`**getProductVariantPricing**(variant, context): Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>`
|
|
|
|
Gets the prices for a product variant.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variant",
|
|
"type": "[Pick](../types/Pick.mdx)<[ProductVariant](ProductVariant.mdx), \"id\" \\| \"product_id\">",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx) \\| [PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "The product variant prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getProductVariantPricingById
|
|
|
|
`**getProductVariantPricingById**(variantId, context): Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>`
|
|
|
|
Gets the prices for a product variant by a variant id.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variantId",
|
|
"type": "`string`",
|
|
"description": "the id of the variant to get prices for",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx) \\| [PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[ProductVariantPricing](../types/ProductVariantPricing.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "The product variant prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Deprecated
|
|
|
|
Use [getProductVariantsPricing](PricingService.mdx#getproductvariantspricing) instead.
|
|
|
|
___
|
|
|
|
#### getProductVariantPricingModulePricing\_
|
|
|
|
`Private **getProductVariantPricingModulePricing_**(variantPriceData, context): Promise<Map<any, any>>`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variantPriceData",
|
|
"type": "``{ quantity?: number ; variantId: string }``[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Map<any, any>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Map<any, any>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getProductVariantPricing\_
|
|
|
|
`Private **getProductVariantPricing_**(data, context): Promise<Map<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "data",
|
|
"type": "``{ quantity?: number ; variantId: string }``[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Map<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Map<string, [ProductVariantPricing](../types/ProductVariantPricing.mdx)>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getProductVariantsPricing
|
|
|
|
`**getProductVariantsPricing**(data, context): Promise<{ [variant_id: string]: [ProductVariantPricing](../types/ProductVariantPricing.mdx); }>`
|
|
|
|
Gets the prices for a collection of variants.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "data",
|
|
"type": "``{ quantity?: number ; variantId: string }``[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx) \\| [PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<{ [variant_id: string]: [ProductVariantPricing](../types/ProductVariantPricing.mdx); }>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<{ [variant_id: string]: [ProductVariantPricing](../types/ProductVariantPricing.mdx); }>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "The product variant prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### getShippingOptionPricing
|
|
|
|
`**getShippingOptionPricing**(shippingOption, context): Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)>`
|
|
|
|
Gets the prices for a shipping option.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "shippingOption",
|
|
"type": "[ShippingOption](ShippingOption.mdx)",
|
|
"description": "the shipping option to get prices for",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx) \\| [PricingContext](../types/PricingContext-1.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "The shipping option prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### setAdminProductPricing
|
|
|
|
`**setAdminProductPricing**(products): Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "products",
|
|
"type": "[Product](Product.mdx)[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<([Product](Product.mdx) \\| [PricedProduct](../types/PricedProduct.mdx))[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### setAdminVariantPricing
|
|
|
|
`**setAdminVariantPricing**(variants, context?): Promise<[PricedVariant](../types/PricedVariant.mdx)[]>`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variants",
|
|
"type": "[ProductVariant](ProductVariant.mdx)[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[PricedVariant](../types/PricedVariant.mdx)[]>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[PricedVariant](../types/PricedVariant.mdx)[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### setProductPrices
|
|
|
|
`**setProductPrices**(products, context?): Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>`
|
|
|
|
Set additional prices on a list of products.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "products",
|
|
"type": "[Product](Product.mdx)[]",
|
|
"description": "list of products on which to set additional prices",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<([Product](Product.mdx) \| [PricedProduct](../types/PricedProduct.mdx))[]>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<([Product](Product.mdx) \\| [PricedProduct](../types/PricedProduct.mdx))[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "A list of products with variants decorated with prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### setShippingOptionPrices
|
|
|
|
`**setShippingOptionPrices**(shippingOptions, context?): Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)[]>`
|
|
|
|
Set additional prices on a list of shipping options.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "shippingOptions",
|
|
"type": "[ShippingOption](ShippingOption.mdx)[]",
|
|
"description": "list of shipping options on which to set additional prices",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[Omit](../types/Omit.mdx)<[PriceSelectionContext](../types/PriceSelectionContext.mdx), \"region_id\">",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)[]>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[PricedShippingOption](../types/PricedShippingOption.mdx)[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "A list of shipping options with prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### setVariantPrices
|
|
|
|
`**setVariantPrices**(variants, context?): Promise<[PricedVariant](../types/PricedVariant.mdx)[]>`
|
|
|
|
Set additional prices on a list of product variants.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variants",
|
|
"type": "[ProductVariant](ProductVariant.mdx)[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "the price selection context to use",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<[PricedVariant](../types/PricedVariant.mdx)[]>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[PricedVariant](../types/PricedVariant.mdx)[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "A list of products with variants decorated with prices",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### shouldRetryTransaction\_
|
|
|
|
`Protected **shouldRetryTransaction_**(err): boolean`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "err",
|
|
"type": "`Record<string, unknown>` \\| ``{ code: string }``",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
`boolean`
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "boolean",
|
|
"type": "`boolean`",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### withTransaction
|
|
|
|
`**withTransaction**(transactionManager?): [PricingService](PricingService.mdx)`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "transactionManager",
|
|
"type": "EntityManager",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
[PricingService](PricingService.mdx)
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "PricingService",
|
|
"type": "[PricingService](PricingService.mdx)",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|