Files
medusa-store/www/apps/docs/content/references/services/interfaces/IPriceSelectionStrategy.mdx
github-actions[bot] cdd42dbdcd chore(docs): Generated References (#5743)
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>
2023-11-27 18:58:52 +00:00

130 lines
2.8 KiB
Plaintext

---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# IPriceSelectionStrategy
## Methods
#### calculateVariantPrice
`**calculateVariantPrice**(data, context): Promise&#60;Map&#60;string, [PriceSelectionResult](../types/PriceSelectionResult.mdx)&#62;&#62;`
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&#60;Map&#60;string, [PriceSelectionResult](../types/PriceSelectionResult.mdx)&#62;&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;Map&#60;string, [PriceSelectionResult](../types/PriceSelectionResult.mdx)&#62;&#62;",
"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&#60;void&#62;`
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&#60;void&#62;
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"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": []
}
]} />