Basket Item Limits by Shop Category
Introduction
A shop category can cap how many items a customer may hold in their basket from that category. When a limit is configured, the basket validates every write against it. The HTTP status code signals the outcome: 206 Partial Content when only part of the requested quantity was applied, 413 Request Entity Too Large when none of it was.
This page describes that API behavior. The limit itself is not a Storefront API concept: it is configured as customData on the shop category in the SCAYLE Panel. For the configuration, the country- and shop-level precedence rules, the inheritance across the category tree, and the tenant setting this feature requires, see Basket Item Limits.
When Validation Runs
The basket validates against the relevant category limits on these actions:
- adding a new item to the basket.
- increasing the quantity of an existing item.
- an unavailable item becoming available again, for example after a restock.
The basket calculates the remaining allowance for a category as the configured limit minus the sum of available items already in the basket from that category and its descendants. A limit applies only when it is greater than 0. A limit of 0 behaves as no limit.
Only available items count toward the limit. Items on the unavailable list (for example, because they went out of stock) are excluded from the sum.
Reducing an existing item's quantity always succeeds, regardless of category limits.
Response Behavior
When a category limit is in effect, a basket write resolves to one of these outcomes:
| Status | Meaning |
|---|---|
201 (add) / 200 (update) | The request was within the remaining allowance. The item was added or updated at the requested quantity. |
206 Partial Content | The remaining allowance covered only part of the requested quantity. That part was applied. Inspect the returned basket to see the applied quantity per item. |
206 Partial Content, item removed | On an update, the category's other items already reach the limit, so no quantity is left for this item. The item is removed from the basket and is missing from the returned basket. |
413 Request Entity Too Large | The remaining allowance is 0: the category's items in the basket already reach the limit. Nothing was applied, and the returned basket is unchanged. |
Adding an item and increasing the quantity of an existing item follow the same rule.
413 is not exclusive to category limits. The same status is returned when a request exceeds the maximum quantity allowed for a single item, or when the basket is at, or the request would take it over, its maximum number of items or units, independently of any category configuration. Do not treat a 413 as proof that a category limit was reached.
Examples
In these examples, variants A and B belong to the same category, the category limit is 2, and both variants are in stock.
| Basket before | Request | Status | Basket after |
|---|---|---|---|
| empty | add A with quantity 3 | 206 Partial Content | A × 2 |
| A × 2 (full) | add B with quantity 1 | 413 Request Entity Too Large | unchanged |
| A × 2 (full) | update A to 3 | 413 Request Entity Too Large | unchanged |
| A × 1 (1 left) | update A to 3 | 206 Partial Content | A × 2 |
| A × 1 (1 left) | add B with quantity 2 | 206 Partial Content | A × 1, B × 1 |
| A × 1, B × 2 (B alone reaches the limit, for example after the limit was lowered) | update A to 2 | 206 Partial Content, item removed | B × 2 |
Affected Endpoints
Both single-item endpoints can return the 206 and 413 responses described above:
POST /v1/baskets/{basketId}/items: add basket item.PATCH /v1/baskets/{basketId}/items/{itemKey}: update basket item.
POST /v1/baskets/{basketId}/bulk checks the same limits for every add and update operation. Instead of a status code per item, each outcome appears in that operation's entry in results:
| Situation | Single-item response | Bulk result |
|---|---|---|
| The limit allows only part of the quantity | 206 Partial Content | "status": "success". quantity holds the applied quantity and requestedQuantity the one you asked for. |
No room is left in the category, on add | 413 Request Entity Too Large | "status": "failed" with error.code CATEGORY_LIMIT_EXCEEDED. The item is not in the basket. |
No room is left in the category, on update | 413 Request Entity Too Large | "status": "success". quantity is unchanged and requestedQuantity holds the one you asked for. |
The category's other items already reach the limit, on update | 206 Partial Content, item removed | "status": "failed" with error.code CATEGORY_LIMIT_EXCEEDED. The item is removed from the basket. |
The response status is 207 Multi-Status as soon as one operation fails. A capped operation does not fail, so it does not trigger 207: when every operation succeeds, including capped ones, the status is 200. To detect a capped operation, compare quantity with requestedQuantity in each result.
Unlike 413, CATEGORY_LIMIT_EXCEEDED only comes from a category limit. The other limits have their own codes, so you can tell them apart. Here, items are the distinct entries in the basket and units are their total quantity.
| Code | Operation | Cause |
|---|---|---|
CATEGORY_LIMIT_EXCEEDED | add, update | A category limit is reached. |
QUANTITY_LIMIT_EXCEEDED | add, update | The item is over its own maximum quantity. |
QUANTITY_LIMIT_EXCEEDED | update | The update would take the basket over its maximum number of units. |
ITEM_LIMIT_EXCEEDED | add | The basket is at its maximum number of items, or the add would take it over its maximum number of units. |
For the full request and response, see Bulk add, update and remove basket items.
Frontend Implementation
Treat 206 as a success that needs reconciliation, not as an error. The call went through, so read the returned basket and render the applied quantities instead of the requested ones. Tell the customer their quantity was capped. A 206 on an update can also mean the item was removed: if it is missing from the returned basket, tell the customer it was removed because the category limit is reached.
Treat 413 as a rejection: the basket is unchanged. The 413 response body contains the current basket, so you can render it without fetching the basket again. The response does not indicate whether a category limit, the per-item maximum quantity or a basket maximum caused it, so show a generic message and do not retry automatically.
For the bulk endpoint, check every entry in results, not only the status code. A failed entry with CATEGORY_LIMIT_EXCEEDED means the item was not added or was removed. A success entry where quantity differs from requestedQuantity means the quantity was capped, even when the response status is 200.
Limits are cached by the basket and refreshed on a schedule. A newly configured or changed limit is not reflected in active baskets immediately, so allow up to 15 minutes before testing the API behavior against it.