---
displayed_sidebar: servicesSidebar
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# PriceListService

Provides layer to manipulate product tags.

## constructor

### Parameters

<ParameterTypes parameters={[
  {
    "name": "__namedParameters",
    "type": "`PriceListConstructorProps`",
    "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": "customerGroupService_",
    "type": "[CustomerGroupService](services.CustomerGroupService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "featureFlagRouter_",
    "type": "`FlagRouter`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "manager_",
    "type": "`EntityManager`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "moneyAmountRepo_",
    "type": "Repository&#60;[MoneyAmount](../../entities/classes/entities.MoneyAmount.mdx)&#62; & `object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "priceListRepo_",
    "type": "Repository&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62; & `object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "productService_",
    "type": "[ProductService](services.ProductService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "productVariantRepo_",
    "type": "Repository&#60;[ProductVariant](../../entities/classes/entities.ProductVariant.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "regionService_",
    "type": "[RegionService](services.RegionService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "transactionManager_",
    "type": "`undefined` \\| `EntityManager`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "variantService_",
    "type": "[ProductVariantService](services.ProductVariantService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

___

## Accessors

### activeManager\_

#### Returns

<ParameterTypes parameters={[
  {
    "name": "EntityManager",
    "type": "`EntityManager`",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

## Methods

### addCurrencyFromRegion

Add `currency_code` to an MA record if `region_id`is passed.

#### Type Parameters

<ParameterTypes parameters={[
  {
    "name": "T",
    "type": "[PriceListPriceUpdateInput](../../medusa/types/medusa.PriceListPriceUpdateInput.mdx) \\| [PriceListPriceCreateInput](../../medusa/types/medusa.PriceListPriceCreateInput.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "prices",
    "type": "`T`[]",
    "description": "a list of PriceListPrice(Create/Update)Input records",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;T[]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "updated `prices` list",
    "expandable": false,
    "children": []
  }
]} />

___

### addPrices

Adds prices to a price list in bulk, optionally replacing all existing prices

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "id of the price list",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "prices",
    "type": "[PriceListPriceCreateInput](../../medusa/types/medusa.PriceListPriceCreateInput.mdx)[]",
    "description": "prices to add",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "replace",
    "type": "`boolean`",
    "description": "whether to replace existing prices",
    "optional": false,
    "defaultValue": "false",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "updated Price List",
    "expandable": false,
    "children": []
  }
]} />

___

### 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

<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&#60;TResult&#62;",
    "description": "the transactional work to be done",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "isolationOrErrorHandler",
    "type": "`IsolationLevel` \\| (`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
    "description": "the isolation level to be used for the work.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "maybeErrorHandlerOrDontFail",
    "type": "(`error`: `TError`) => Promise&#60;void \\| TResult&#62;",
    "description": "Potential error handler",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;TResult&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the result of the transactional work",
    "expandable": false,
    "children": []
  }
]} />

___

### clearPrices

Removes all prices from a price list and deletes the removed prices in bulk

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "id of the price list",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "updated Price List",
    "expandable": false,
    "children": []
  }
]} />

___

### create

Creates a Price List

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListObject",
    "type": "[CreatePriceListInput](../../medusa/types/medusa.CreatePriceListInput.mdx)",
    "description": "the Price List to create",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "created Price List",
    "expandable": false,
    "children": []
  }
]} />

___

### delete

Deletes a Price List
Will never fail due to delete being idempotent.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "id of the price list",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "empty promise",
    "expandable": false,
    "children": []
  }
]} />

___

### deletePrices

Removes prices from a price list and deletes the removed prices in bulk

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "id of the price list",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "priceIds",
    "type": "`string`[]",
    "description": "ids of the prices to delete",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "updated Price List",
    "expandable": false,
    "children": []
  }
]} />

___

### deleteProductPrices

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "productIds",
    "type": "`string`[]",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[string[], number]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### deleteVariantPrices

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "variantIds",
    "type": "`string`[]",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[string[], number]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### list

Lists Price Lists

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "selector",
    "type": "[FilterablePriceListProps](../../medusa/classes/medusa.FilterablePriceListProps.mdx)",
    "description": "the query object for find",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "description": "the config to be used for find",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)[]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the result of the find operation",
    "expandable": false,
    "children": []
  }
]} />

___

### listAndCount

Lists Price Lists and adds count

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "selector",
    "type": "[FilterablePriceListProps](../../medusa/classes/medusa.FilterablePriceListProps.mdx)",
    "description": "the query object for find",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "description": "the config to be used for find",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[[PriceList](../../entities/classes/entities.PriceList.mdx)[], number]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the result of the find operation",
    "expandable": false,
    "children": []
  }
]} />

___

### listPriceListsVariantIdsMap

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListIds",
    "type": "`string` \\| `string`[]",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;object&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### listProducts

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "selector",
    "type": "[FilterableProductProps](../../medusa/classes/medusa.FilterableProductProps.mdx) \\| [Selector](../../medusa/types/medusa.Selector.mdx)&#60;[Product](../../entities/classes/entities.Product.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[Product](../../entities/classes/entities.Product.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "requiresPriceList",
    "type": "`boolean`",
    "description": "",
    "optional": false,
    "defaultValue": "false",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[[Product](../../entities/classes/entities.Product.mdx)[], number]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### listVariants

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "selector",
    "type": "[FilterableProductVariantProps](../../product/interfaces/product.FilterableProductVariantProps.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[ProductVariant](../../entities/classes/entities.ProductVariant.mdx)&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "requiresPriceList",
    "type": "`boolean`",
    "description": "",
    "optional": false,
    "defaultValue": "false",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[[ProductVariant](../../entities/classes/entities.ProductVariant.mdx)[], number]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### retrieve

Retrieves a product tag by id.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListId",
    "type": "`string`",
    "description": "the id of the product tag to retrieve",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "description": "the config to retrieve the tag by",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "the collection.",
    "expandable": false,
    "children": []
  }
]} />

___

### shouldRetryTransaction\_

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "err",
    "type": "`Record<string, unknown>` \\| `object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "boolean",
    "type": "`boolean`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### update

Updates a Price List

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "the id of the Product List to update",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "update",
    "type": "[UpdatePriceListInput](../../medusa/types/medusa.UpdatePriceListInput.mdx)",
    "description": "the update to apply",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[PriceList](../../entities/classes/entities.PriceList.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "updated Price List",
    "expandable": false,
    "children": []
  }
]} />

___

### upsertCustomerGroups\_

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "priceListId",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customerGroups",
    "type": "`object`[]",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />

___

### withTransaction

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "transactionManager",
    "type": "`EntityManager`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "PriceListService",
    "type": "`object`",
    "description": "Provides layer to manipulate product tags.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />
