chore(docs): Generated References (#5666)

Generated the following references:
- `entities`
- `js-client`
- `pricing`
- `services`

Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-11-21 12:36:09 +00:00
committed by GitHub
parent 4774b8ff3a
commit 2b9e8bda5e
178 changed files with 10576 additions and 718 deletions

View File

@@ -0,0 +1,315 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/addPriceListPrices
sidebar_label: addPriceListPrices
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# addPriceListPrices - Pricing Module Reference
This documentation provides a reference to the `addPriceListPrices` method. This belongs to the Pricing Module.
This method is used to add prices to price lists.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function addPriceListPrices (items: {
priceListId: string,
prices: {
currency_code: string,
amount: number,
price_set_id: string
}[]
}[]) {
const pricingService = await initializePricingModule()
const priceLists = await pricingService.addPriceListPrices(items)
// do something with the price lists or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[AddPriceListPricesDTO](../../interfaces/AddPriceListPricesDTO.mdx)[]",
"description": "The prices to add for each price list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "priceListId",
"type": "`string`",
"description": "The ID of the price list to add prices to.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "prices",
"type": "[PriceListPriceDTO](../../interfaces/PriceListPriceDTO.mdx)[]",
"description": "The prices to add.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency",
"type": "[CreateCurrencyDTO](../../interfaces/CreateCurrencyDTO.mdx)",
"description": "The currency of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "The currency code of this money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "max_quantity",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "min_quantity",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The updated price lists.",
"expandable": false,
"children": [
{
"name": "PriceListDTO[]",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -22,7 +22,7 @@ This method adds prices to a price set.
To add a default price to a price set, don't pass it any rules and make sure to pass it the `currency_code`:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -47,7 +47,7 @@ async function addPricesToPriceSet (priceSetId: string) {
To add prices with rules:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -120,7 +120,7 @@ async function addPricesToPriceSet (priceSetId: string) {
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": true,
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
@@ -154,7 +154,7 @@ async function addPricesToPriceSet (priceSetId: string) {
},
{
"name": "max_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -163,7 +163,7 @@ async function addPricesToPriceSet (priceSetId: string) {
},
{
"name": "min_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -194,7 +194,7 @@ async function addPricesToPriceSet (priceSetId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -221,7 +221,7 @@ async function addPricesToPriceSet (priceSetId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -280,10 +280,10 @@ async function addPricesToPriceSet (priceSetId: string) {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -321,6 +321,15 @@ async function addPricesToPriceSet (priceSetId: string) {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
@@ -383,7 +392,7 @@ This method adds prices to multiple price sets.
To add a default price to a price set, don't pass it any rules and make sure to pass it the `currency_code`:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -408,7 +417,7 @@ async function addPricesToPriceSet (priceSetId: string) {
To add prices with rules:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -481,7 +490,7 @@ async function addPricesToPriceSet (priceSetId: string) {
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": true,
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
@@ -515,7 +524,7 @@ async function addPricesToPriceSet (priceSetId: string) {
},
{
"name": "max_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -524,7 +533,7 @@ async function addPricesToPriceSet (priceSetId: string) {
},
{
"name": "min_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -555,7 +564,7 @@ async function addPricesToPriceSet (priceSetId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -582,7 +591,7 @@ async function addPricesToPriceSet (priceSetId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method adds rules to a price set.
### Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -60,8 +60,8 @@ async function addRulesToPriceSet (priceSetId: string) {
},
{
"name": "rules",
"type": "`&#123; attribute: string &#125;`[]",
"description": "The rules to add to a price set. The value of `attribute` is the value of the rule's `rule_attribute` attribute.",
"type": "``{ attribute: string }``[]",
"description": "The rules to add to a price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -69,7 +69,7 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "attribute",
"type": "`string`",
"description": "",
"description": "The value of the rule's `rule_attribute` attribute.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -90,7 +90,7 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -117,7 +117,7 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -176,10 +176,10 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -217,6 +217,15 @@ async function addRulesToPriceSet (priceSetId: string) {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
@@ -277,7 +286,7 @@ This method adds rules to multiple price sets.
### Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -317,8 +326,8 @@ async function addRulesToPriceSet (priceSetId: string) {
},
{
"name": "rules",
"type": "`&#123; attribute: string &#125;`[]",
"description": "The rules to add to a price set. The value of `attribute` is the value of the rule's `rule_attribute` attribute.",
"type": "``{ attribute: string }``[]",
"description": "The rules to add to a price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -326,7 +335,7 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "attribute",
"type": "`string`",
"description": "",
"description": "The value of the rule's `rule_attribute` attribute.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -347,7 +356,7 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -374,7 +383,7 @@ async function addRulesToPriceSet (priceSetId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to calculate prices based on the provided filters and contex
When you calculate prices, you must at least specify the currency code:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function calculatePrice (priceSetId: string, currencyCode: string) {
@@ -42,7 +42,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
To calculate prices for specific minimum and/or maximum quantity:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function calculatePrice (priceSetId: string, currencyCode: string) {
@@ -65,7 +65,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
To calculate prices for custom rule types:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function calculatePrice (priceSetId: string, currencyCode: string) {
@@ -137,7 +137,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -164,7 +164,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -196,7 +196,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
"children": [
{
"name": "amount",
"type": "``null`` \\| `number`",
"type": "`null` \\| `string`",
"description": "The calculated amount. It can possibly be `null` if there's no price set up for the provided context.",
"optional": false,
"defaultValue": "",
@@ -205,7 +205,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
},
{
"name": "currency_code",
"type": "``null`` \\| `string`",
"type": "`null` \\| `string`",
"description": "The currency code of the calculated price. It can possibly be `null`.",
"optional": false,
"defaultValue": "",
@@ -215,7 +215,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
{
"name": "id",
"type": "`string`",
"description": "The ID of the price set.",
"description": "The ID of the money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -223,7 +223,7 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
},
{
"name": "max_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `string`",
"description": "The maximum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.",
"optional": false,
"defaultValue": "",
@@ -232,12 +232,39 @@ async function calculatePrice (priceSetId: string, currencyCode: string) {
},
{
"name": "min_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `string`",
"description": "The minimum quantity required to be purchased for this price to apply. It's set if the `quantity` property is provided in the context. Otherwise, its value will be `null`.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`null` \\| `string`",
"description": "The ID of the associated price list, if any.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_type",
"type": "`null` \\| `string`",
"description": "The type of the associated price list, if any.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}

View File

@@ -114,7 +114,7 @@ async function createPriceSet() {
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": true,
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
@@ -148,7 +148,7 @@ async function createPriceSet() {
},
{
"name": "max_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -157,7 +157,7 @@ async function createPriceSet() {
},
{
"name": "min_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -177,8 +177,8 @@ async function createPriceSet() {
},
{
"name": "rules",
"type": "`&#123; rule_attribute: string &#125;`[]",
"description": "The rules to associate with the price set. The value of `attribute` is the value of the rule's `rule_attribute` attribute.",
"type": "``{ rule_attribute: string }``[]",
"description": "The rules to associate with the price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -186,7 +186,7 @@ async function createPriceSet() {
{
"name": "rule_attribute",
"type": "`string`",
"description": "",
"description": "the value of the rule's `rule_attribute` attribute.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -207,7 +207,7 @@ async function createPriceSet() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -234,7 +234,7 @@ async function createPriceSet() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -293,10 +293,10 @@ async function createPriceSet() {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -334,6 +334,15 @@ async function createPriceSet() {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
@@ -485,7 +494,7 @@ async function createPriceSets() {
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": true,
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
@@ -519,7 +528,7 @@ async function createPriceSets() {
},
{
"name": "max_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -528,7 +537,7 @@ async function createPriceSets() {
},
{
"name": "min_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -548,8 +557,8 @@ async function createPriceSets() {
},
{
"name": "rules",
"type": "`&#123; rule_attribute: string &#125;`[]",
"description": "The rules to associate with the price set. The value of `attribute` is the value of the rule's `rule_attribute` attribute.",
"type": "``{ rule_attribute: string }``[]",
"description": "The rules to associate with the price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -557,7 +566,7 @@ async function createPriceSets() {
{
"name": "rule_attribute",
"type": "`string`",
"description": "",
"description": "the value of the rule's `rule_attribute` attribute.",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -578,7 +587,7 @@ async function createPriceSets() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -605,7 +614,7 @@ async function createPriceSets() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -96,7 +96,7 @@ async function createCurrencies() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -123,7 +123,7 @@ async function createCurrencies() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -55,7 +55,7 @@ async function retrieveMoneyAmounts() {
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": true,
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
@@ -126,7 +126,7 @@ async function retrieveMoneyAmounts() {
},
{
"name": "max_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -135,7 +135,7 @@ async function retrieveMoneyAmounts() {
},
{
"name": "min_quantity",
"type": "``null`` \\| `number`",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
@@ -155,7 +155,7 @@ async function retrieveMoneyAmounts() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -182,7 +182,7 @@ async function retrieveMoneyAmounts() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -232,10 +232,10 @@ async function retrieveMoneyAmounts() {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -273,6 +273,15 @@ async function retrieveMoneyAmounts() {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
}

View File

@@ -0,0 +1,211 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createPriceListRules
sidebar_label: createPriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createPriceListRules - Pricing Module Reference
This documentation provides a reference to the `createPriceListRules` method. This belongs to the Pricing Module.
This method is used to create price list rules.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function createPriceListRules (items: {
rule_type_id: string
price_list_id: string
}[]) {
const pricingService = await initializePricingModule()
const priceListRules = await pricingService.createPriceListRules(items)
// do something with the price list rule or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[CreatePriceListRuleDTO](../../interfaces/CreatePriceListRuleDTO.mdx)[]",
"description": "The price list rules to create.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "price_list",
"type": "`string` \\| [PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The ID of a price list or the details of an existing price list to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`",
"description": "The ID of a price list to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type",
"type": "`string` \\| [RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The ID of a rule type or the details of an existing rule type to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type_id",
"type": "`string`",
"description": "The ID of a rule type to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The created price list rules.",
"expandable": false,
"children": [
{
"name": "PriceListRuleDTO[]",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -0,0 +1,414 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/createPriceLists
sidebar_label: createPriceLists
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# createPriceLists - Pricing Module Reference
This documentation provides a reference to the `createPriceLists` method. This belongs to the Pricing Module.
This method is used to create price lists.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function createPriceList (items: {
title: string
description: string
starts_at?: string
ends_at?: string
}[]) {
const pricingService = await initializePricingModule()
const priceList = await pricingService.createPriceLists(items)
// do something with the price lists or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[CreatePriceListDTO](../../interfaces/CreatePriceListDTO.mdx)[]",
"description": "The details of each price list to be created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "description",
"type": "`string`",
"description": "The price list's description.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ends_at",
"type": "`string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with the price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "prices",
"type": "[PriceListPriceDTO](../../interfaces/PriceListPriceDTO.mdx)[]",
"description": "The prices associated with the price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "amount",
"type": "`number`",
"description": "The amount of this money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency",
"type": "[CreateCurrencyDTO](../../interfaces/CreateCurrencyDTO.mdx)",
"description": "The currency of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "The currency code of this money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "max_quantity",
"type": "`null` \\| `number`",
"description": "The maximum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "min_quantity",
"type": "`null` \\| `number`",
"description": "The minimum quantity required to be purchased for this money amount to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rules",
"type": "[CreatePriceListRules](../../interfaces/CreatePriceListRules.mdx)",
"description": "The rules to be created and associated with the price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "starts_at",
"type": "`string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "type",
"type": "[PriceListType](../../enums/PriceListType.mdx)",
"description": "The price list's type.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "OVERRIDE",
"type": "`\"override\"`",
"description": "The price list's prices override original prices. This affects the calculated price of associated price sets.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "SALE",
"type": "`\"sale\"`",
"description": "The price list's prices are used for a sale.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The created price lists.",
"expandable": false,
"children": [
{
"name": "PriceListDTO[]",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -18,16 +18,16 @@ This method is used to create new price rules based on the provided data.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function createPriceRules (
id: string,
priceSetId: string,
ruleTypeId: string,
value: string,
priceSetMoneyAmountId: string,
priceSetId: string,
ruleTypeId: string,
value: string,
priceSetMoneyAmountId: string,
priceListId: string
) {
const pricingService = await initializePricingModule()
@@ -67,15 +67,6 @@ async function createPriceRules (
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`",
"description": "The ID of the associated price list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
@@ -88,7 +79,7 @@ async function createPriceRules (
{
"name": "price_set_money_amount_id",
"type": "`string`",
"description": "The ID of the associated price set money amount.",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -97,7 +88,7 @@ async function createPriceRules (
{
"name": "priority",
"type": "`number`",
"description": "The priority of the price rule in comparison to other applicable price rules.",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -134,7 +125,7 @@ async function createPriceRules (
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -161,7 +152,7 @@ async function createPriceRules (
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -220,10 +211,10 @@ async function createPriceRules (
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The associated price set. It may only be available if the relation `price_set` is expanded.",
"description": "The associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -256,10 +247,10 @@ async function createPriceRules (
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{

View File

@@ -19,7 +19,7 @@ a rule type.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -89,7 +89,7 @@ async function createPriceSetMoneyAmountRules (priceSetMoneyAmountId: string, ru
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -116,7 +116,7 @@ async function createPriceSetMoneyAmountRules (priceSetMoneyAmountId: string, ru
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -166,19 +166,19 @@ async function createPriceSetMoneyAmountRules (priceSetMoneyAmountId: string, ru
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The associated price set money amount. It may only be available if the relation `price_set_money_amount` is expanded.",
"description": "The associated price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{

View File

@@ -94,7 +94,7 @@ async function createRuleTypes() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -121,7 +121,7 @@ async function createRuleTypes() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -18,7 +18,7 @@ This method deletes price sets by their IDs.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -52,7 +52,7 @@ async function removePriceSetRule (priceSetIds: string[]) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -79,7 +79,7 @@ async function removePriceSetRule (priceSetIds: string[]) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -50,7 +50,7 @@ async function deleteCurrencies() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -77,7 +77,7 @@ async function deleteCurrencies() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -18,7 +18,7 @@ This method deletes money amounts by their IDs.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -54,7 +54,7 @@ async function deleteMoneyAmounts (moneyAmountIds: string[]) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -81,7 +81,7 @@ async function deleteMoneyAmounts (moneyAmountIds: string[]) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -0,0 +1,113 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deletePriceListRules
sidebar_label: deletePriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deletePriceListRules - Pricing Module Reference
This documentation provides a reference to the `deletePriceListRules` method. This belongs to the Pricing Module.
This method is used to delete price list rules.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deletePriceListRules (priceListRuleIds: string[]) {
const pricingService = await initializePricingModule()
await pricingService.deletePriceListRules(priceListRuleIds)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "priceListRuleIds",
"type": "`string`[]",
"description": "The IDs of the price list rules to delete.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves successfully when the price list rules are deleted.",
"expandable": false,
"children": []
}
]} />

View File

@@ -0,0 +1,113 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/deletePriceLists
sidebar_label: deletePriceLists
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# deletePriceLists - Pricing Module Reference
This documentation provides a reference to the `deletePriceLists` method. This belongs to the Pricing Module.
This method is used to delete price lists.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function deletePriceLists (ids: string[]) {
const pricingService = await initializePricingModule()
await pricingService.deletePriceLists(ids)
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "priceListIds",
"type": "`string`[]",
"description": "The IDs of the price lists to delete.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;void&#62;",
"optional": false,
"defaultValue": "",
"description": "Resolves when the price lists are deleted successfully.",
"expandable": false,
"children": []
}
]} />

View File

@@ -18,7 +18,7 @@ This method is used to delete price rules based on the specified IDs.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -54,7 +54,7 @@ async function deletePriceRules (
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -81,7 +81,7 @@ async function deletePriceRules (
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -18,7 +18,7 @@ This method is used to delete price set money amount rules based on the specifie
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -52,7 +52,7 @@ async function deletePriceSetMoneyAmountRule (id: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -79,7 +79,7 @@ async function deletePriceSetMoneyAmountRule (id: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -18,7 +18,7 @@ This method is used to delete rule types based on the provided IDs.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -52,7 +52,7 @@ async function deleteRuleTypes (ruleTypeId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -79,7 +79,7 @@ async function deleteRuleTypes (ruleTypeId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of price sets based on optional
To retrieve a list of price sets using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrievePriceSets (priceSetIds: string[]) {
To specify relations that should be retrieved within the price sets:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -63,7 +63,7 @@ async function retrievePriceSets (priceSetIds: string[]) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -88,10 +88,10 @@ async function retrievePriceSets (priceSetIds: string[], skip: number, take: num
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
@@ -290,7 +290,7 @@ async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -317,7 +317,7 @@ async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of price sets along with the to
To retrieve a list of prices sets using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrievePriceSets (priceSetIds: string[]) {
To specify relations that should be retrieved within the price sets:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -63,7 +63,7 @@ async function retrievePriceSets (priceSetIds: string[]) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -88,10 +88,10 @@ async function retrievePriceSets (priceSetIds: string[], skip: number, take: num
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
@@ -290,7 +290,7 @@ async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -317,7 +317,7 @@ async function retrievePriceSets (priceSetIds: string[], moneyAmountIds: string[
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of currencies along with the to
To retrieve a list of currencies using their codes:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrieveCurrencies (codes: string[]) {
To specify attributes that should be retrieved within the money amounts:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -63,7 +63,7 @@ async function retrieveCurrencies (codes: string[]) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -210,7 +210,7 @@ async function retrieveCurrencies (codes: string[], skip: number, take: number)
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -237,7 +237,7 @@ async function retrieveCurrencies (codes: string[], skip: number, take: number)
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of money amounts along with the
To retrieve a list of money amounts using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
To specify relations that should be retrieved within the money amounts:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -63,7 +63,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -88,7 +88,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], skip: number, tak
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -251,7 +251,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: str
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -278,7 +278,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: str
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -0,0 +1,349 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountPriceListRules
sidebar_label: listAndCountPriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# listAndCountPriceListRules - Pricing Module Reference
This documentation provides a reference to the `listAndCountPriceListRules` method. This belongs to the Pricing Module.
This method is used to retrieve a paginated list of price list ruless along with the total count of available price list ruless satisfying the provided filters.
## Example
To retrieve a list of price list vs using their IDs:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listAndCountPriceListRules (priceListRuleIds: string[]) {
const pricingService = await initializePricingModule()
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
{
id: priceListRuleIds
},
)
// do something with the price list rules or return them
}
```
To specify relations that should be retrieved within the price list rules:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listAndCountPriceListRules (priceListRuleIds: string[]) {
const pricingService = await initializePricingModule()
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
{
id: priceListRuleIds
},
{
relations: ["price_list_rule_values"]
}
)
// do something with the price list rules or return them
}
```
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listAndCountPriceListRules (priceListRuleIds: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
{
id: priceListRuleIds
},
{
relations: ["price_list_rule_values"],
skip,
take
}
)
// do something with the price list rules or return them
}
```
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listAndCountPriceListRules (priceListRuleIds: string[], ruleTypeIDs: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const [priceListRules, count] = await pricingService.listAndCountPriceListRules(
{
$and: [
{
id: priceListRuleIds
},
{
rule_types: ruleTypeIDs
}
]
},
{
relations: ["price_list_rule_values"],
skip,
take
}
)
// do something with the price list rules or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "filters",
"type": "[FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx)",
"description": "The filters to apply on the retrieved price list rules.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "([FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "([FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`[]",
"description": "The IDs to filter price list rules by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`[]",
"description": "Filter price list rules by the ID of their associated price lists.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type",
"type": "`string`[]",
"description": "Filter price list rules by the ID of their associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "value",
"type": "`string`[]",
"description": "The values to filter price list rules by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "config",
"type": "[FindConfig](../../interfaces/FindConfig.mdx)&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)&#62;",
"description": "The configurations determining how the price list rules are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "__type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[], number]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of price list rules along with their total count.",
"expandable": false,
"children": [
{
"name": "PriceListRuleDTO[]",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
},
{
"name": "number",
"type": "`number`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />

View File

@@ -0,0 +1,377 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listAndCountPriceLists
sidebar_label: listAndCountPriceLists
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# listAndCountPriceLists - Pricing Module Reference
This documentation provides a reference to the `listAndCountPriceLists` method. This belongs to the Pricing Module.
This method is used to retrieve a paginated list of price lists along with the total count of available price lists satisfying the provided filters.
## Example
To retrieve a list of price lists using their IDs:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceLists (priceListIds: string[]) {
const pricingService = await initializePricingModule()
const [priceLists, count] = await pricingService.listPriceLists(
{
id: priceListIds
},
)
// do something with the price lists or return them
}
```
To specify relations that should be retrieved within the price lists:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceLists (priceListIds: string[]) {
const pricingService = await initializePricingModule()
const [priceLists, count] = await pricingService.listPriceLists(
{
id: priceListIds
},
{
relations: ["price_set_money_amounts"]
}
)
// do something with the price lists or return them
}
```
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceLists (priceListIds: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const [priceLists, count] = await pricingService.listPriceLists(
{
id: priceListIds
},
{
relations: ["price_set_money_amounts"],
skip,
take
}
)
// do something with the price lists or return them
}
```
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceLists (priceListIds: string[], titles: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const [priceLists, count] = await pricingService.listPriceLists(
{
$and: [
{
id: priceListIds
},
{
title: titles
}
]
},
{
relations: ["price_set_money_amounts"],
skip,
take
}
)
// do something with the price lists or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "filters",
"type": "[FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx)",
"description": "The filters to apply on the retrieved price lists.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "([FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "([FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ends_at",
"type": "`string`[]",
"description": "The end dates to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`[]",
"description": "The IDs to filter price lists by",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "number_rules",
"type": "`number`[]",
"description": "The number of rules to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "starts_at",
"type": "`string`[]",
"description": "The start dates to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)[]",
"description": "The statuses to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "config",
"type": "[FindConfig](../../interfaces/FindConfig.mdx)&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)&#62;",
"description": "The configurations determining how the price lists are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "__type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[[PriceListDTO](../../interfaces/PriceListDTO.mdx)[], number]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of price lists along with their total count.",
"expandable": false,
"children": [
{
"name": "PriceListDTO[]",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
},
{
"name": "number",
"type": "`number`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]
}
]} />

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of price rules along with the t
To retrieve a list of price rules using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrievePriceRules (id: string) {
To specify relations that should be retrieved within the price rules:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -58,7 +58,7 @@ async function retrievePriceRules (id: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -80,7 +80,7 @@ async function retrievePriceRules (id: string, skip: number, take: number) {
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -258,7 +258,7 @@ async function retrievePriceRules (ids: string[], name: string[], skip: number,
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -285,7 +285,7 @@ async function retrievePriceRules (ids: string[], name: string[], skip: number,
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -13,7 +13,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
This documentation provides a reference to the `listAndCountPriceSetMoneyAmountRules` method. This belongs to the Pricing Module.
This method is used to retrieve a paginated list of price set money amount rules along with the total count of
This method is used to retrieve a paginated list of price set money amount rules along with the total count of
available price set money amount rules satisfying the provided filters.
## Example
@@ -21,7 +21,7 @@ available price set money amount rules satisfying the provided filters.
To retrieve a list of price set money amounts using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -39,7 +39,7 @@ async function retrievePriceSetMoneyAmountRules (id: string) {
To specify relations that should be retrieved within the price set money amount rules:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -59,7 +59,7 @@ async function retrievePriceSetMoneyAmountRules (id: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -81,7 +81,7 @@ async function retrievePriceSetMoneyAmountRules (id: string, skip: number, take:
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -259,7 +259,7 @@ async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: stri
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -286,7 +286,7 @@ async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: stri
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -13,7 +13,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
This documentation provides a reference to the `listAndCountPriceSetMoneyAmounts` method. This belongs to the Pricing Module.
This method is used to retrieve a paginated list of price set money amounts along with the total count of
This method is used to retrieve a paginated list of price set money amounts along with the total count of
available price set money amounts satisfying the provided filters.
## Example
@@ -21,7 +21,7 @@ available price set money amounts satisfying the provided filters.
To retrieve a list of price set money amounts using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -39,7 +39,7 @@ async function retrievePriceSetMoneyAmounts (id: string) {
To specify relations that should be retrieved within the price set money amounts:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -59,7 +59,7 @@ async function retrievePriceSetMoneyAmounts (id: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -81,7 +81,7 @@ async function retrievePriceSetMoneyAmounts (id: string, skip: number, take: num
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -145,6 +145,15 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`[]",
"description": "The IDs to filter the price set money amount's associated price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_id",
"type": "`string`[]",
@@ -241,7 +250,7 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -268,7 +277,7 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of rule types along with the to
To retrieve a list of rule types using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrieveRuleTypes (ruleTypeId: string) {
To specify attributes that should be retrieved within the rule types:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -62,7 +62,7 @@ async function retrieveRuleTypes (ruleTypeId: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -86,7 +86,7 @@ async function retrieveRuleTypes (ruleTypeId: string, skip: number, take: number
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -255,7 +255,7 @@ async function retrieveRuleTypes (ruleTypeId: string[], name: string[], skip: nu
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -282,7 +282,7 @@ async function retrieveRuleTypes (ruleTypeId: string[], name: string[], skip: nu
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of currencies based on optional
To retrieve a list of currencies using their codes:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrieveCurrencies (codes: string[]) {
To specify attributes that should be retrieved within the money amounts:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -63,7 +63,7 @@ async function retrieveCurrencies (codes: string[]) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -210,7 +210,7 @@ async function retrieveCurrencies (codes: string[], skip: number, take: number)
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -237,7 +237,7 @@ async function retrieveCurrencies (codes: string[], skip: number, take: number)
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of money amounts based on optio
To retrieve a list of money amounts using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
To specify relations that should be retrieved within the money amounts:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -63,7 +63,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -88,7 +88,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], skip: number, tak
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -251,7 +251,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: str
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -278,7 +278,7 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: str
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -328,10 +328,10 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: str
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -369,6 +369,15 @@ async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: str
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
}

View File

@@ -0,0 +1,386 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listPriceListRules
sidebar_label: listPriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# listPriceListRules - Pricing Module Reference
This documentation provides a reference to the `listPriceListRules` method. This belongs to the Pricing Module.
This method is used to retrieve a paginated list of price list rules based on optional filters and configuration.
## Example
To retrieve a list of price list vs using their IDs:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceListRules (priceListRuleIds: string[]) {
const pricingService = await initializePricingModule()
const priceListRules = await pricingService.listPriceListRules(
{
id: priceListRuleIds
},
)
// do something with the price list rules or return them
}
```
To specify relations that should be retrieved within the price list rules:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceListRules (priceListRuleIds: string[]) {
const pricingService = await initializePricingModule()
const priceListRules = await pricingService.listPriceListRules(
{
id: priceListRuleIds
},
{
relations: ["price_list_rule_values"]
}
)
// do something with the price list rules or return them
}
```
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceListRules (priceListRuleIds: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const priceListRules = await pricingService.listPriceListRules(
{
id: priceListRuleIds
},
{
relations: ["price_list_rule_values"],
skip,
take
}
)
// do something with the price list rules or return them
}
```
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceListRules (priceListRuleIds: string[], ruleTypeIDs: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const priceListRules = await pricingService.listPriceListRules(
{
$and: [
{
id: priceListRuleIds
},
{
rule_types: ruleTypeIDs
}
]
},
{
relations: ["price_list_rule_values"],
skip,
take
}
)
// do something with the price list rules or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "filters",
"type": "[FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx)",
"description": "The filters to apply on the retrieved price list rules.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "([FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "([FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListRuleProps](../../interfaces/FilterablePriceListRuleProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`[]",
"description": "The IDs to filter price list rules by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`[]",
"description": "Filter price list rules by the ID of their associated price lists.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type",
"type": "`string`[]",
"description": "Filter price list rules by the ID of their associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "value",
"type": "`string`[]",
"description": "The values to filter price list rules by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "config",
"type": "[FindConfig](../../interfaces/FindConfig.mdx)&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)&#62;",
"description": "The configurations determining how the price list rules are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "__type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of price list rules.",
"expandable": false,
"children": [
{
"name": "PriceListRuleDTO[]",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -0,0 +1,468 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/listPriceLists
sidebar_label: listPriceLists
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# listPriceLists - Pricing Module Reference
This documentation provides a reference to the `listPriceLists` method. This belongs to the Pricing Module.
This method is used to retrieve a paginated list of price lists based on optional filters and configuration.
## Example
To retrieve a list of price lists using their IDs:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceLists (priceListIds: string[]) {
const pricingService = await initializePricingModule()
const priceLists = await pricingService.listPriceLists(
{
id: priceListIds
},
)
// do something with the price lists or return them
}
```
To specify relations that should be retrieved within the price lists:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceLists (priceListIds: string[]) {
const pricingService = await initializePricingModule()
const priceLists = await pricingService.listPriceLists(
{
id: priceListIds
},
{
relations: ["price_set_money_amounts"]
}
)
// do something with the price lists or return them
}
```
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceLists (priceListIds: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const priceLists = await pricingService.listPriceLists(
{
id: priceListIds
},
{
relations: ["price_set_money_amounts"],
skip,
take
}
)
// do something with the price lists or return them
}
```
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function listPriceLists (priceListIds: string[], titles: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()
const priceLists = await pricingService.listPriceLists(
{
$and: [
{
id: priceListIds
},
{
title: titles
}
]
},
{
relations: ["price_set_money_amounts"],
skip,
take
}
)
// do something with the price lists or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "filters",
"type": "[FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx)",
"description": "The filters to apply on the retrieved price lists.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "$and",
"type": "([FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"and\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "$or",
"type": "([FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx) \\| [BaseFilterable](../../interfaces/BaseFilterable.mdx)&#60;[FilterablePriceListProps](../../interfaces/FilterablePriceListProps.mdx)&#62;)[]",
"description": "An array of filters to apply on the entity, where each item in the array is joined with an \"or\" condition.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ends_at",
"type": "`string`[]",
"description": "The end dates to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`[]",
"description": "The IDs to filter price lists by",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "number_rules",
"type": "`number`[]",
"description": "The number of rules to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "starts_at",
"type": "`string`[]",
"description": "The start dates to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)[]",
"description": "The statuses to filter price lists by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
},
{
"name": "config",
"type": "[FindConfig](../../interfaces/FindConfig.mdx)&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)&#62;",
"description": "The configurations determining how the price lists are retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "__type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The list of price lists.",
"expandable": false,
"children": [
{
"name": "PriceListDTO[]",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of price rules based on optiona
To retrieve a list of price rules using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrievePriceRules (id: string) {
To specify relations that should be retrieved within the price rules:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -58,7 +58,7 @@ async function retrievePriceRules (id: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -80,7 +80,7 @@ async function retrievePriceRules (id: string, skip: number, take: number) {
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -258,7 +258,7 @@ async function retrievePriceRules (ids: string[], name: string[], skip: number,
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -285,7 +285,7 @@ async function retrievePriceRules (ids: string[], name: string[], skip: number,
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -344,10 +344,10 @@ async function retrievePriceRules (ids: string[], name: string[], skip: number,
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The associated price set. It may only be available if the relation `price_set` is expanded.",
"description": "The associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -380,10 +380,10 @@ async function retrievePriceRules (ids: string[], name: string[], skip: number,
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of price set money amount rules
To retrieve a list of price set money amount rules using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrievePriceSetMoneyAmountRules (id: string) {
To specify relations that should be retrieved within the price set money amount rules:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -58,7 +58,7 @@ async function retrievePriceSetMoneyAmountRules (id: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -80,7 +80,7 @@ async function retrievePriceSetMoneyAmountRules (id: string, skip: number, take:
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -258,7 +258,7 @@ async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: stri
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -285,7 +285,7 @@ async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: stri
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -335,19 +335,19 @@ async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: stri
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The associated price set money amount. It may only be available if the relation `price_set_money_amount` is expanded.",
"description": "The associated price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of price set money amounts base
To retrieve a list of price set money amounts using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrievePriceSetMoneyAmounts (id: string) {
To specify relations that should be retrieved within the price set money amounts:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -58,7 +58,7 @@ async function retrievePriceSetMoneyAmounts (id: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -80,7 +80,7 @@ async function retrievePriceSetMoneyAmounts (id: string, skip: number, take: num
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -144,6 +144,15 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`[]",
"description": "The IDs to filter the price set money amount's associated price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_id",
"type": "`string`[]",
@@ -240,7 +249,7 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -267,7 +276,7 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -317,34 +326,43 @@ async function retrievePriceSetMoneyAmounts (ids: string[], titles: string[], sk
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount. It may only be available if the relation `money_amount` is expanded.",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../interfaces/PriceRuleDTO.mdx)[]",
"description": "",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount. It may only be available if the relation `price_set` is expanded.",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a paginated list of rule types based on optional
To retrieve a list of rule types using their IDs:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -40,7 +40,7 @@ async function retrieveRuleTypes (ruleTypeId: string) {
To specify attributes that should be retrieved within the rule types:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -62,7 +62,7 @@ async function retrieveRuleTypes (ruleTypeId: string) {
By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -86,7 +86,7 @@ async function retrieveRuleTypes (ruleTypeId: string, skip: number, take: number
You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -255,7 +255,7 @@ async function retrieveRuleTypes (ruleTypeId: string[], name: string[], skip: nu
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -282,7 +282,7 @@ async function retrieveRuleTypes (ruleTypeId: string[], name: string[], skip: nu
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -0,0 +1,513 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/removePriceListRules
sidebar_label: removePriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# removePriceListRules - Pricing Module Reference
This documentation provides a reference to the `removePriceListRules` method. This belongs to the Pricing Module.
This method is used to remove rules from a price list.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function setPriceListRules (priceListId: string) {
const pricingService = await initializePricingModule()
const priceList = await pricingService.removePriceListRules({
priceListId,
rules: ["region_id"]
})
// do something with the price list or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[RemovePriceListRulesDTO](../../interfaces/RemovePriceListRulesDTO.mdx)",
"description": "The rules to remove from a price list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "priceListId",
"type": "`string`",
"description": "The ID of the price list to remove rules from.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rules",
"type": "`string`[]",
"description": "The rules to remove from the price list. Each item being a rule type's `rule_attribute`.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The updated price lists.",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "amount",
"type": "`number`",
"description": "The price of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "The currency code of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "max_quantity",
"type": "`number`",
"description": "The maximum quantity required to be purchased for this price to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "min_quantity",
"type": "`number`",
"description": "The minimum quantity required to be purchased for this price to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of a price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../interfaces/PriceRuleDTO.mdx)[]",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "default_priority",
"type": "`number`",
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The display name of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_attribute",
"type": "`string`",
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />

View File

@@ -18,7 +18,7 @@ This method remove rules from a price set.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -76,7 +76,7 @@ async function removePriceSetRule (priceSetId: string, ruleAttributes: []) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -103,7 +103,7 @@ async function removePriceSetRule (priceSetId: string, ruleAttributes: []) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -13,14 +13,14 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
This documentation provides a reference to the `retrieve` method. This belongs to the Pricing Module.
This method is used to retrieves a price set by its ID.
This method is used to retrieve a price set by its ID.
## Example
A simple example that retrieves a price set by its ID:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrievePriceSet (priceSetId: string) {
To specify relations that should be retrieved:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -153,7 +153,7 @@ async function retrievePriceSet (priceSetId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -180,7 +180,7 @@ async function retrievePriceSet (priceSetId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -239,10 +239,10 @@ async function retrievePriceSet (priceSetId: string) {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -280,6 +280,15 @@ async function retrievePriceSet (priceSetId: string) {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},

View File

@@ -20,7 +20,7 @@ This method retrieves a currency by its code and and optionally based on the pro
A simple example that retrieves a currency by its code:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrieveCurrency (code: string) {
To specify attributes that should be retrieved:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -153,7 +153,7 @@ async function retrieveCurrency (code: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -180,7 +180,7 @@ async function retrieveCurrency (code: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -20,7 +20,7 @@ This method retrieves a money amount by its ID.
To retrieve a money amount by its ID:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -38,7 +38,7 @@ async function retrieveMoneyAmount (moneyAmountId: string) {
To retrieve relations along with the money amount:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -153,7 +153,7 @@ async function retrieveMoneyAmount (moneyAmountId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -180,7 +180,7 @@ async function retrieveMoneyAmount (moneyAmountId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -222,10 +222,10 @@ async function retrieveMoneyAmount (moneyAmountId: string) {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": [
{
"name": "code",
@@ -300,6 +300,79 @@ async function retrieveMoneyAmount (moneyAmountId: string) {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of a price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../interfaces/PriceRuleDTO.mdx)[]",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}

View File

@@ -0,0 +1,590 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrievePriceList
sidebar_label: retrievePriceList
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# retrievePriceList - Pricing Module Reference
This documentation provides a reference to the `retrievePriceList` method. This belongs to the Pricing Module.
This method is used to retrieve a price list by its ID.
## Example
A simple example that retrieves a price list by its ID:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceList (priceListId: string) {
const pricingService = await initializePricingModule()
const priceList = await pricingService.retrievePriceList(
priceListId
)
// do something with the price list or return it
}
```
To specify relations that should be retrieved:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceList (priceListId: string) {
const pricingService = await initializePricingModule()
const priceList = await pricingService.retrievePriceList(
priceListId,
{
relations: ["price_set_money_amounts"]
}
)
// do something with the price list or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the price list to retrieve.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[FindConfig](../../interfaces/FindConfig.mdx)&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)&#62;",
"description": "The configurations determining how the price list is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "__type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The retrieved price list.",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "amount",
"type": "`number`",
"description": "The price of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "The currency code of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "max_quantity",
"type": "`number`",
"description": "The maximum quantity required to be purchased for this price to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "min_quantity",
"type": "`number`",
"description": "The minimum quantity required to be purchased for this price to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of a price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../interfaces/PriceRuleDTO.mdx)[]",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "default_priority",
"type": "`number`",
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The display name of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_attribute",
"type": "`string`",
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />

View File

@@ -0,0 +1,425 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/retrievePriceListRule
sidebar_label: retrievePriceListRule
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# retrievePriceListRule - Pricing Module Reference
This documentation provides a reference to the `retrievePriceListRule` method. This belongs to the Pricing Module.
This method is used to retrieve a price list rule by its ID.
## Example
A simple example that retrieves a price list rule by its ID:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceListRule (priceListRuleId: string) {
const pricingService = await initializePricingModule()
const priceListRule = await pricingService.retrievePriceListRule(
priceListRuleId
)
// do something with the price list rule or return it
}
```
To specify relations that should be retrieved:
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceListRule (priceListRuleId: string) {
const pricingService = await initializePricingModule()
const priceListRule = await pricingService.retrievePriceListRule(
priceListRuleId,
{
relations: ["price_list"]
}
)
// do something with the price list rule or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The ID of the price list rule to retrieve.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "config",
"type": "[FindConfig](../../interfaces/FindConfig.mdx)&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)&#62;",
"description": "The configurations determining how the price list rule is retrieved. Its properties, such as `select` or `relations`, accept the attributes or relations associated with a price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "order",
"type": "`object`",
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "__type",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "relations",
"type": "`string`[]",
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "select",
"type": "(`string` \\| keyof `Entity`)[]",
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "skip",
"type": "`number`",
"description": "A number indicating the number of records to skip before retrieving the results.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "take",
"type": "`number`",
"description": "A number indicating the number of records to return in the result.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "withDeleted",
"type": "`boolean`",
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the `SoftDeletableEntity` class.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The retrieved price list rule.",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule value's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rule",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)",
"description": "The associated price list rule.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The rule's value.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "default_priority",
"type": "`number`",
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The display name of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_attribute",
"type": "`string`",
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a price rule by its ID.
A simple example that retrieves a price rule by its ID:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -36,7 +36,7 @@ async function retrievePriceRule (id: string) {
To specify relations that should be retrieved:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -148,7 +148,7 @@ async function retrievePriceRule (id: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -175,7 +175,7 @@ async function retrievePriceRule (id: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -226,10 +226,10 @@ async function retrievePriceRule (id: string) {
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The associated price set. It may only be available if the relation `price_set` is expanded.",
"description": "The associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": [
{
"name": "id",
@@ -290,10 +290,10 @@ async function retrievePriceRule (id: string) {
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": [
{
"name": "default_priority",

View File

@@ -20,7 +20,7 @@ This method is used to a price set money amount rule by its ID based on the prov
A simple example that retrieves a price set money amount rule by its ID:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -36,7 +36,7 @@ async function retrievePriceSetMoneyAmountRule (id: string) {
To specify relations that should be retrieved:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -148,7 +148,7 @@ async function retrievePriceSetMoneyAmountRule (id: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -175,7 +175,7 @@ async function retrievePriceSetMoneyAmountRule (id: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -217,10 +217,10 @@ async function retrievePriceSetMoneyAmountRule (id: string) {
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The associated price set money amount. It may only be available if the relation `price_set_money_amount` is expanded.",
"description": "The associated price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": [
{
"name": "id",
@@ -234,34 +234,43 @@ async function retrievePriceSetMoneyAmountRule (id: string) {
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount. It may only be available if the relation `money_amount` is expanded.",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../interfaces/PriceRuleDTO.mdx)[]",
"description": "",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount. It may only be available if the relation `price_set` is expanded.",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -281,10 +290,10 @@ async function retrievePriceSetMoneyAmountRule (id: string) {
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": [
{
"name": "default_priority",

View File

@@ -20,7 +20,7 @@ This method is used to retrieve a rule type by its ID and and optionally based o
A simple example that retrieves a rule type by its code:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -36,7 +36,7 @@ async function retrieveRuleType (ruleTypeId: string) {
To specify attributes that should be retrieved:
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -148,7 +148,7 @@ async function retrieveRuleType (ruleTypeId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -175,7 +175,7 @@ async function retrieveRuleType (ruleTypeId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -0,0 +1,515 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/setPriceListRules
sidebar_label: setPriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# setPriceListRules - Pricing Module Reference
This documentation provides a reference to the `setPriceListRules` method. This belongs to the Pricing Module.
This method is used to set the rules of a price list.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function setPriceListRules (priceListId: string) {
const pricingService = await initializePricingModule()
const priceList = await pricingService.setPriceListRules({
priceListId,
rules: {
region_id: "US"
}
})
// do something with the price list or return it
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[SetPriceListRulesDTO](../../interfaces/SetPriceListRulesDTO.mdx)",
"description": "The rules to set for a price list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "priceListId",
"type": "`string`",
"description": "The ID of the price list to add rules to.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rules",
"type": "`Record<string, string \\| string[]>`",
"description": "The rules to add to the price list. Each key of the object is a rule type's `rule_attribute`, and its value is the value(s) of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)&#62;",
"optional": false,
"defaultValue": "",
"description": "The updated price lists.",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "amount",
"type": "`number`",
"description": "The price of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "The currency code of this money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "max_quantity",
"type": "`number`",
"description": "The maximum quantity required to be purchased for this price to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "min_quantity",
"type": "`number`",
"description": "The minimum quantity required to be purchased for this price to be applied.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of a price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amount",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)",
"description": "The money amount associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The price list associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_rules",
"type": "[PriceRuleDTO](../../interfaces/PriceRuleDTO.mdx)[]",
"description": "The price rules associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The price set associated with the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The title of the price set money amount.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "default_priority",
"type": "`number`",
"description": "The priority of the rule type. This is useful when calculating the price of a price set, and multiple rules satisfy the provided context. The higher the value, the higher the priority of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "name",
"type": "`string`",
"description": "The display name of the rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_attribute",
"type": "`string`",
"description": "The unique name used to later identify the rule\\_attribute. For example, it can be used in the `context` parameter of the `calculatePrices` method to specify a rule for calculating the price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />

View File

@@ -94,7 +94,7 @@ async function updateCurrencies() {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -121,7 +121,7 @@ async function updateCurrencies() {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,

View File

@@ -18,7 +18,7 @@ This method updates existing money amounts.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -27,7 +27,7 @@ async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
const moneyAmounts = await pricingService.updateMoneyAmounts([
{
id: moneyAmountId,
id: moneyAmountId,
amount
}
])
@@ -105,7 +105,7 @@ async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -132,7 +132,7 @@ async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -182,10 +182,10 @@ async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
{
"name": "currency",
"type": "[CurrencyDTO](../../interfaces/CurrencyDTO.mdx)",
"description": "The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.",
"description": "The money amount's currency.",
"optional": true,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -223,6 +223,15 @@ async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The details of the relation between the money amount and its associated price set.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
}
]
}

View File

@@ -0,0 +1,221 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updatePriceListRules
sidebar_label: updatePriceListRules
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# updatePriceListRules - Pricing Module Reference
This documentation provides a reference to the `updatePriceListRules` method. This belongs to the Pricing Module.
This method is used to update price list rules.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function updatePriceListRules (items: {
id: string
rule_type_id?: string
price_list_id?: string
}[]) {
const pricingService = await initializePricingModule()
const priceListRules = await pricingService.updatePriceListRules(items)
// do something with the price list rule or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[UpdatePriceListRuleDTO](../../interfaces/UpdatePriceListRuleDTO.mdx)[]",
"description": "The attributes to update for each price list rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The ID of the price list rule to update.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "`string`",
"description": "The ID of a price list to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_id",
"type": "`string`",
"description": "The ID of a price list to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type",
"type": "`string`",
"description": "The ID of a rule type or the details of an existing rule type to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rule_type_id",
"type": "`string`",
"description": "The ID of a rule type to be associated with the price list rule.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The updated price list rules.",
"expandable": false,
"children": [
{
"name": "PriceListRuleDTO[]",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "The price list rule's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)",
"description": "The associated price list.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_list_rule_values",
"type": "[PriceListRuleValueDTO](../../interfaces/PriceListRuleValueDTO.mdx)[]",
"description": "The associated rule values.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "value",
"type": "`string`",
"description": "The value of the rule.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -0,0 +1,314 @@
---
displayed_sidebar: pricingReference
badge:
variant: orange
text: Beta
slug: /references/pricing/updatePriceLists
sidebar_label: updatePriceLists
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# updatePriceLists - Pricing Module Reference
This documentation provides a reference to the `updatePriceLists` method. This belongs to the Pricing Module.
This method is used to update price lists.
## Example
```ts
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function updatePriceLists (items: {
id: string
title: string
description: string
starts_at?: string
ends_at?: string
}[]) {
const pricingService = await initializePricingModule()
const priceList = await pricingService.updatePriceLists(items)
// do something with the price lists or return them
}
```
## Parameters
<ParameterTypes parameters={[
{
"name": "data",
"type": "[UpdatePriceListDTO](../../interfaces/UpdatePriceListDTO.mdx)[]",
"description": "The attributes to update in each price list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The ID of the price list to update.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with the price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "rules",
"type": "[CreatePriceListRules](../../interfaces/CreatePriceListRules.mdx)",
"description": "The rules to be created and associated with the price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "starts_at",
"type": "`string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "ACTIVE",
"type": "`\"active\"`",
"description": "The price list is enabled and its prices can be used.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "DRAFT",
"type": "`\"draft\"`",
"description": "The price list is disabled, meaning its prices can't be used yet.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "sharedContext",
"type": "[Context](../../interfaces/Context.mdx)",
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationLevel",
"type": "`string`",
"description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager",
"type": "`TManager`",
"description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionId",
"type": "`string`",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager",
"type": "`TManager`",
"description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]} />
## Returns
<ParameterTypes parameters={[
{
"name": "Promise",
"type": "Promise&#60;[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]&#62;",
"optional": false,
"defaultValue": "",
"description": "The updated price lists.",
"expandable": false,
"children": [
{
"name": "PriceListDTO[]",
"type": "[PriceListDTO](../../interfaces/PriceListDTO.mdx)[]",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": [
{
"name": "ends_at",
"type": "`null` \\| `string`",
"description": "The price list expires after this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The price list's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "money_amounts",
"type": "[MoneyAmountDTO](../../interfaces/MoneyAmountDTO.mdx)[]",
"description": "The associated money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "number_rules",
"type": "`number`",
"description": "The number of rules associated with this price list.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "price_list_rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "price_set_money_amounts",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)[]",
"description": "The associated price set money amounts.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rule_types",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)[]",
"description": "The associated rule types.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "rules",
"type": "[PriceListRuleDTO](../../interfaces/PriceListRuleDTO.mdx)[]",
"description": "The price set's rules.",
"optional": true,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "starts_at",
"type": "`null` \\| `string`",
"description": "The price list is enabled starting from this date.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "status",
"type": "[PriceListStatus](../../enums/PriceListStatus.mdx)",
"description": "The price list's status.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "The price list's title.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]} />

View File

@@ -18,13 +18,13 @@ This method is used to update price rules, each with their provided data.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function updatePriceRules (
id: string,
priceSetId: string,
priceSetId: string,
) {
const pricingService = await initializePricingModule()
@@ -53,7 +53,7 @@ async function updatePriceRules (
{
"name": "id",
"type": "`string`",
"description": "The ID of the price rule to update.",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
@@ -71,7 +71,7 @@ async function updatePriceRules (
{
"name": "price_set_id",
"type": "`string`",
"description": "The ID of the associated price set.",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -98,7 +98,7 @@ async function updatePriceRules (
{
"name": "rule_type_id",
"type": "`string`",
"description": "The ID of the associated rule type.",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -126,7 +126,7 @@ async function updatePriceRules (
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -153,7 +153,7 @@ async function updatePriceRules (
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -212,10 +212,10 @@ async function updatePriceRules (
{
"name": "price_set",
"type": "[PriceSetDTO](../../interfaces/PriceSetDTO.mdx)",
"description": "The associated price set. It may only be available if the relation `price_set` is expanded.",
"description": "The associated price set.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
@@ -248,10 +248,10 @@ async function updatePriceRules (
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{

View File

@@ -18,7 +18,7 @@ This method is used to update price set money amount rules, each with their prov
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -96,7 +96,7 @@ async function updatePriceSetMoneyAmountRules (id: string, value: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -123,7 +123,7 @@ async function updatePriceSetMoneyAmountRules (id: string, value: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -173,19 +173,19 @@ async function updatePriceSetMoneyAmountRules (id: string, value: string) {
{
"name": "price_set_money_amount",
"type": "[PriceSetMoneyAmountDTO](../../interfaces/PriceSetMoneyAmountDTO.mdx)",
"description": "The associated price set money amount. It may only be available if the relation `price_set_money_amount` is expanded.",
"description": "The associated price set money amount.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{
"name": "rule_type",
"type": "[RuleTypeDTO](../../interfaces/RuleTypeDTO.mdx)",
"description": "The associated rule type. It may only be available if the relation `rule_type` is expanded.",
"description": "The associated rule type.",
"optional": false,
"defaultValue": "",
"expandable": false,
"expandable": true,
"children": []
},
{

View File

@@ -18,7 +18,7 @@ This method is used to update existing rule types with the provided data.
## Example
```ts
import {
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
@@ -96,7 +96,7 @@ async function updateRuleTypes (ruleTypeId: string) {
{
"name": "enableNestedTransactions",
"type": "`boolean`",
"description": "a boolean value indicating whether nested transactions are enabled.",
"description": "A boolean value indicating whether nested transactions are enabled.",
"optional": true,
"defaultValue": "",
"expandable": false,
@@ -123,7 +123,7 @@ async function updateRuleTypes (ruleTypeId: string) {
{
"name": "transactionId",
"type": "`string`",
"description": "a string indicating the ID of the current transaction.",
"description": "A string indicating the ID of the current transaction.",
"optional": true,
"defaultValue": "",
"expandable": false,