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>
130 lines
2.8 KiB
Plaintext
130 lines
2.8 KiB
Plaintext
---
|
|
displayed_sidebar: servicesSidebar
|
|
---
|
|
|
|
import ParameterTypes from "@site/src/components/ParameterTypes"
|
|
|
|
# IPriceSelectionStrategy
|
|
|
|
## Methods
|
|
|
|
#### calculateVariantPrice
|
|
|
|
`**calculateVariantPrice**(data, context): Promise<Map<string, [PriceSelectionResult](../types/PriceSelectionResult.mdx)>>`
|
|
|
|
Calculate the original and discount price for a given variant in a set of
|
|
circumstances described in the context.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "data",
|
|
"type": "``{ quantity?: number ; variantId: string }``[]",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "context",
|
|
"type": "[PriceSelectionContext](../types/PriceSelectionContext.mdx)",
|
|
"description": "Details relevant to determine the correct pricing of the variant",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<Map<string, [PriceSelectionResult](../types/PriceSelectionResult.mdx)>>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<Map<string, [PriceSelectionResult](../types/PriceSelectionResult.mdx)>>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "pricing details in an object containing the calculated lowest price,\nthe default price an all valid prices for the given variant",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### onVariantsPricesUpdate
|
|
|
|
`**onVariantsPricesUpdate**(variantIds): Promise<void>`
|
|
|
|
Notify price selection strategy that variants prices have been updated.
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "variantIds",
|
|
"type": "`string`[]",
|
|
"description": "The ids of the updated variants",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
Promise<void>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<void>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
#### withTransaction
|
|
|
|
`**withTransaction**(transactionManager?): [IPriceSelectionStrategy](IPriceSelectionStrategy.mdx)`
|
|
|
|
##### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "transactionManager",
|
|
"type": "EntityManager",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
##### Returns
|
|
|
|
[IPriceSelectionStrategy](IPriceSelectionStrategy.mdx)
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "IPriceSelectionStrategy",
|
|
"type": "[IPriceSelectionStrategy](IPriceSelectionStrategy.mdx)",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|