diff --git a/www/apps/book/app/learn/deployment/general/page.mdx b/www/apps/book/app/learn/deployment/general/page.mdx index 6c43dd8d04..0f5ea3d438 100644 --- a/www/apps/book/app/learn/deployment/general/page.mdx +++ b/www/apps/book/app/learn/deployment/general/page.mdx @@ -151,7 +151,7 @@ module.exports = defineConfig({ options: { providers: [ { - resolve: "@medusajs/cache-redis", + resolve: "@medusajs/caching-redis", id: "caching-redis", is_default: true, options: { diff --git a/www/apps/book/generated/edit-dates.mjs b/www/apps/book/generated/edit-dates.mjs index c9a40e9b68..a2351e16a2 100644 --- a/www/apps/book/generated/edit-dates.mjs +++ b/www/apps/book/generated/edit-dates.mjs @@ -94,7 +94,7 @@ export const generatedEditDates = { "app/learn/fundamentals/custom-cli-scripts/seed-data/page.mdx": "2025-09-15T16:02:51.362Z", "app/learn/fundamentals/environment-variables/page.mdx": "2025-05-26T15:06:07.800Z", "app/learn/build/page.mdx": "2025-10-17T14:48:44.767Z", - "app/learn/deployment/general/page.mdx": "2025-09-29T10:21:24.768Z", + "app/learn/deployment/general/page.mdx": "2025-10-21T07:39:08.998Z", "app/learn/fundamentals/workflows/multiple-step-usage/page.mdx": "2025-08-01T14:59:59.501Z", "app/learn/installation/page.mdx": "2025-07-23T14:28:50.404Z", "app/learn/fundamentals/data-models/check-constraints/page.mdx": "2025-07-25T13:50:21.065Z", diff --git a/www/apps/book/public/llms-full.txt b/www/apps/book/public/llms-full.txt index 49261c31f2..dd345e4f1b 100644 --- a/www/apps/book/public/llms-full.txt +++ b/www/apps/book/public/llms-full.txt @@ -6534,7 +6534,7 @@ module.exports = defineConfig({ options: { providers: [ { - resolve: "@medusajs/cache-redis", + resolve: "@medusajs/caching-redis", id: "caching-redis", is_default: true, options: { @@ -37367,7 +37367,7 @@ The [ApplicationMethod data model](https://docs.medusajs.com/references/promotio |---|---|---| |\`type\`|Does the promotion discount a fixed amount or a percentage?|\`fixed\`| |\`target\_type\`|Is the promotion applied to a cart item, shipping method, or the entire order?|\`items\`| -|\`allocation\`|Is the discounted amount applied to each item or split between the applicable items?|\`each\`| +|\`allocation\`|Is the discounted amount applied to each item, split between the applicable items, or applied on specific number of items?|\`each\`| ## Target Promotion Rules @@ -37395,7 +37395,11 @@ In this example, the cart must have two product variants with the SKU `SHIRT` fo ## Maximum Quantity Restriction -When the `allocation` property in the `ApplicationMethod` is set to `each`, you can set the `max_quantity` property of `ApplicationMethod` to limit how many item quantities the promotion is applied to. +You can restrict how many items the promotion is applied to either at the item level or the cart level. + +### Item Level Restriction + +When the `allocation` property in the `ApplicationMethod` is set to `each`, you can set the `max_quantity` property of `ApplicationMethod` to limit how many quantities of each applicable item the promotion is applied to. For example, if the `max_quantity` property is set to `1` and the customer has a line item with quantity two in the cart, the promotion is only applied to one of them. @@ -37431,6 +37435,110 @@ This condition is applied on the quantity of every applicable item in the cart. } ``` +### Cart Level Restriction + +The `once` allocation type is available from [Medusa v2.11.0](https://github.com/medusajs/medusa/releases/tag/v2.11.0). + +When the `allocation` property in the `ApplicationMethod` is set to `once`, you must set the `max_quantity` property of `ApplicationMethod`. It limits how many items in total the promotion is applied to. + +In this scenario, the Promotion Module prioritizes which applicable items the promotion is applied to based on the following rules: + +1. Prioritize items with the lowest price. +2. Distribute the promotion sequentially until the `max_quantity` is reached. + +#### Example 1 + +Consider: + +- A promotion whose application method has its `allocation` property set to `once` and `max_quantity` set to `2`. +- A cart with three items having different prices, each with a quantity of `1`. + +The Promotion Module will apply the promotion to the two items with the lowest price. + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "price": 10, + "quantity": 1 // The promotion is applied to this item + }, + { + "id": "item_2", + "price": 20, + "quantity": 1 // The promotion is applied to this item + }, + { + "id": "item_3", + "price": 30, + "quantity": 1 // The promotion is NOT applied to this item + } + ] + } +} +``` + +#### Example 2 + +Consider: + +- A promotion whose application method has its `allocation` property set to `once` and `max_quantity` set to `2`. +- A cart with two items having different prices and quantities greater than `2`. + +The Promotion Module will try to apply the promotion to the item with the lowest price first: + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "price": 10, + "quantity": 3 // The promotion is applied to 2 of this item + }, + { + "id": "item_2", + "price": 20, + "quantity": 4 // The promotion is NOT applied to this item + } + ] + } +} +``` + +Since that item has a quantity of `3`, the promotion is applied to `2` of that item, reaching the `max_quantity` limit. The promotion is not applied to the other item. + +#### Example 3 + +Consider: + +- A promotion whose application method has its `allocation` property set to `once` and `max_quantity` set to `5`. +- A cart with two items having different prices and quantities less than `5`. + +The Promotion Module will try to apply the promotion to the item with the lowest price first: + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "price": 10, + "quantity": 3 // The promotion is applied to all 3 of this item + }, + { + "id": "item_2", + "price": 20, + "quantity": 4 // The promotion is applied to 2 of this item + } + ] + } +} +``` + +The promotion is applied to all `3` quantities of the item with the lowest price. Since the `max_quantity` is `5`, the promotion is applied to `2` quantities of the other item, reaching the `max_quantity` limit. + # Campaign @@ -122136,7 +122244,7 @@ export const getCustomerDigitalProducts = async () => { headers, next, - cache: "force-cache", + cache: "no-cache", }) return digital_products as DigitalProduct[] @@ -122314,7 +122422,7 @@ export const getDigitalMediaDownloadLink = async (mediaId: string) => { method: "POST", headers, next, - cache: "force-cache", + cache: "no-cache", }) return url