diff --git a/www/apps/book/public/llms-full.txt b/www/apps/book/public/llms-full.txt index f04787a608..04689a6882 100644 --- a/www/apps/book/public/llms-full.txt +++ b/www/apps/book/public/llms-full.txt @@ -35864,6 +35864,46 @@ The application method has a collection of `PromotionRule` items to define the In this example, the cart must have two product variants with the SKU `SHIRT` for the promotion to be applied. +*** + +## Maxiumum Quantity Restriction + +When the `allocation` property in the `ApplicationMethod` is set to `each`, you can restrict the maximum quantity of each applicable item that the promotion is applied to in the cart. + +For example, if the maximum quantity 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. + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "quantity": 2 // The promotion is applied to 1 of this item + } + ] + } +} +``` + +This condition is applied on the quantity of every applicable item in the cart. For example, if set to `1` and the customer has two applicable items in the cart, the promotion is applied to one of each of them. + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "quantity": 2 // The promotion is applied to 1 of this item + }, + { + "id": "item_2", + "quantity": 3 // The promotion is applied to 1 of this item + } + ] + } +} +``` + # Campaign diff --git a/www/apps/resources/app/commerce-modules/promotion/application-method/page.mdx b/www/apps/resources/app/commerce-modules/promotion/application-method/page.mdx index d11fb49921..6a685b09fd 100644 --- a/www/apps/resources/app/commerce-modules/promotion/application-method/page.mdx +++ b/www/apps/resources/app/commerce-modules/promotion/application-method/page.mdx @@ -107,4 +107,44 @@ The application method has a collection of `PromotionRule` items to define the ![A diagram showcasing the buy_rules relation between the ApplicationMethod and PromotionRule data models](https://res.cloudinary.com/dza7lstvk/image/upload/v1709898453/Medusa%20Resources/application-method-buy-rules_djjuhw.jpg) -In this example, the cart must have two product variants with the SKU `SHIRT` for the promotion to be applied. \ No newline at end of file +In this example, the cart must have two product variants with the SKU `SHIRT` for the promotion to be applied. + +--- + +## Maxiumum Quantity Restriction + +When the `allocation` property in the `ApplicationMethod` is set to `each`, you can restrict the maximum quantity of each applicable item that the promotion is applied to in the cart. + +For example, if the maximum quantity 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. + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "quantity": 2 // The promotion is applied to 1 of this item + } + ] + } +} +``` + +This condition is applied on the quantity of every applicable item in the cart. For example, if set to `1` and the customer has two applicable items in the cart, the promotion is applied to one of each of them. + +```json title="Example Cart" +{ + "cart": { + "items": [ + { + "id": "item_1", + "quantity": 2 // The promotion is applied to 1 of this item + }, + { + "id": "item_2", + "quantity": 3 // The promotion is applied to 1 of this item + } + ] + } +} +``` \ No newline at end of file diff --git a/www/apps/resources/generated/edit-dates.mjs b/www/apps/resources/generated/edit-dates.mjs index 17514c5ace..8eaaad65f9 100644 --- a/www/apps/resources/generated/edit-dates.mjs +++ b/www/apps/resources/generated/edit-dates.mjs @@ -68,7 +68,7 @@ export const generatedEditDates = { "app/commerce-modules/promotion/_events/_events-table/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/promotion/_events/page.mdx": "2024-07-03T19:27:13+03:00", "app/commerce-modules/promotion/actions/page.mdx": "2025-06-27T15:42:19.142Z", - "app/commerce-modules/promotion/application-method/page.mdx": "2025-09-01T15:22:53.403Z", + "app/commerce-modules/promotion/application-method/page.mdx": "2025-10-01T09:54:44.931Z", "app/commerce-modules/promotion/campaign/page.mdx": "2025-02-26T11:32:24.484Z", "app/commerce-modules/promotion/concepts/page.mdx": "2025-02-26T11:31:54.391Z", "app/commerce-modules/promotion/page.mdx": "2025-04-17T08:48:14.643Z", diff --git a/www/apps/user-guide/app/promotions/create/page.mdx b/www/apps/user-guide/app/promotions/create/page.mdx index 43fe08528f..813f248b90 100644 --- a/www/apps/user-guide/app/promotions/create/page.mdx +++ b/www/apps/user-guide/app/promotions/create/page.mdx @@ -74,7 +74,9 @@ If you chose the "Amount off Products" promotion type in the first section, fill ![Who can use this section](https://res.cloudinary.com/dza7lstvk/image/upload/v1739898104/User%20Guide/Screenshot_2025-02-18_at_7.01.14_PM_wvskll.png) 6. In the Promotion Value field, set the amount to be discounted from applicable products when the promotion is applied. The amount is in the currency you chose in the previous section. -7. In the Maximum Quantity field, set the maximum quantity of the applicable that the promotion is applied to in the cart. For example, if set to `1` and the customer has two applicable items in the cart, the promotion is only applied to one of them. +7. In the Maximum Quantity field, set the maximum quantity line-item quantity that the promotion is applied to in the cart. + - For example, if 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. + - This condition is applied on the quantity of every applicable item in the cart. For example, if set to `1` and the customer has two applicable items in the cart, the promotion is applied to one of each of them. 8. In the "What items will the promotion be applied to?" section, you'll specify the items in the cart that the promotion can be applied to. To add a condition, click on the "Add condition" button. For each condition: - Select the attribute in the first field. This is the attribute that the condition applies to. It can be: - **Product**: The promotion applies / doesn't apply to the specified product(s). diff --git a/www/apps/user-guide/generated/edit-dates.mjs b/www/apps/user-guide/generated/edit-dates.mjs index 4ec8296050..fef5dfd342 100644 --- a/www/apps/user-guide/generated/edit-dates.mjs +++ b/www/apps/user-guide/generated/edit-dates.mjs @@ -40,7 +40,7 @@ export const generatedEditDates = { "app/products/create/bundle/page.mdx": "2025-05-30T13:29:15.958Z", "app/products/create/multi-part/page.mdx": "2025-05-30T13:29:20.321Z", "app/promotions/campaigns/page.mdx": "2025-05-30T13:29:54.241Z", - "app/promotions/create/page.mdx": "2025-05-30T13:29:58.799Z", + "app/promotions/create/page.mdx": "2025-10-01T09:51:15.062Z", "app/promotions/manage/page.mdx": "2025-05-30T13:30:02.678Z", "app/promotions/page.mdx": "2025-05-30T13:30:08.538Z", "app/price-lists/create/page.mdx": "2025-05-30T13:28:41.126Z",