---
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": []
  }
]} />
