> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Order quantity of a product

> How to define minimum and maximum order quantities, a lot size, and customer-specific lot sizes for products in WEBSALE V8s.

How much a buyer may order of a product is controlled through three independent mechanisms. They can be used individually or in combination.

| Mechanism | Effect | Applies to |
| - | - | - |
| Minimum and maximum order quantity | limits the quantity from below and above | all buyers or individual buyers |
| Lot size | allows only multiples of a lot size | all buyers |
| Customer-specific lot size | allows only multiples of a buyer-specific lot size | individual buyer groups |

## Minimum and maximum order quantity

As a rule, you maintain both limits per product. They then apply equally to every buyer.

In addition, the limits can be set per buyer and per sub-shop based on the customer number. Here, the meaning of the upper limit changes fundamentally: it then no longer refers to the individual order, but to all of the buyer's orders together. Whether they use up their quota in one or in twenty orders does not matter. WEBSALE V8s subtracts the purchased quantity from the remaining maximum quantity with every purchase.

Reference: Section OrderConditions&#x20;

### Enabling customer-specific order quantities

The customer-specific variant is off by default. Enable it in the shop configuration `shop.config` in the `<Login>` section.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<Login>
   ...
   MaxUserOrderQuantity-Allow      = yes
   ...
</Login>
```

Only the value `yes` activates the function. Any other value and a missing parameter leave it off.

Using the `MaxUserOrderQuantitySubshop` parameter, which is also located there, you specify which sub-shop the quantities refer to.

> [!WARNING]
>
> The customer-specific order quantity setting requires a closed shop with mandatory registration at shop start. Without a known buyer there is no quota that the shop could track.

Reference: Section Login&#x20;

### With dependent variants

Quotas are kept per product number. With dependent variants, you must therefore do two things:

* assign a separate product number to each dependent variant
* set the minimum or maximum order quantity of the buyer for each dependent variant

Without their own product numbers the variants cannot be distinguished.

### Assignment via an import file

The quantities per buyer and product can be passed to the WSPManager via an import file. You will receive the format from WEBSALE AG.

Guide: Minimum order value and small quantity surcharge&#x20;

## Lot size

With a lot size, the shop only accepts order quantities that are an integer multiple of the specified lot size. It is maintained per product in the WSPManager.

The benefit lies in the price display. The following example shows both paths for the same offer: a case of wine with twelve bottles at 98.40 EUR.

| Path | Maintenance | Display for the buyer |
| - | - | - |
| without lot size | packaging unit "1 case of 12 bottles" at 98.40 EUR | a case price |
| with lot size | unit price 8.20 EUR and lot size 12 | a bottle price, orderable in steps of twelve |

With a lot size the buyer can only order 12, 24, 36, 48 and so on, but sees the more attractive unit price.

The quantity field is pre-filled from the outset with the smallest permitted quantity, in the example therefore with 12. If the buyer nevertheless enters an unsuitable quantity, the shop displays a message.

### Setting the text for the message

You set the text in the `shop.config` in the `<NotifyMessages-Txt>` section behind the parameter `ProductUnitFactor`.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<NotifyMessages-Txt>
   ...
   ProductUnitFactor = Bitte geben Sie eine Menge an, die ein Vielfaches der angegebenen Stückelung ist.
   ...
</NotifyMessages-Txt>
```

Reference: Section NotifyMessages-Txt&#x20;

### Outputting the lot size in the template

Two tags belong together and are easily confused.

| Tag | Content | Example value |
| - | - | - |
| `PR-UnitFactor` | the lot size | `12` |
| `PR-Unit` | the unit of the product | `Flaschen` |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
Bestellbar in Schritten von ~PR-UnitFactor~ ~PR-Unit~
```

> [!NOTE]
>
> Without a maintained lot size, the shop does not check anything, and every quantity is then permitted. For products with dependent variants, the check only takes effect if a quantity interpolation is set for the variant.

## Customer-specific lot size

Instead of one lot size for everyone, here you assign different lot sizes to different buyer groups. Buyer and product are connected via a freely chosen ID.

> [!NOTE]
>
> If a general lot size is already set on the product, it is overwritten for the buyer in question by the customer-specific one. For all other buyers, the general one continues to apply.

Activation by WEBSALE is not required.

### Step 1: Enter the ID in the customer data

Enter an ID in the customer data of the buyers in question. All buyers with the same ID will later receive the same lot size. The ID is compared without regard to upper and lower case.

The field and the transfer format are given in the interfaces documentation at [doku.websale.de/schnittstellen](https://doku.websale.de/schnittstellen).

### Step 2: Enter the lot sizes in the product data

Enter the desired lot sizes for the products in question and link each one via the ID to a buyer group. Multiple lot sizes for different groups are possible per product.

The setting only takes effect when both sides are maintained. If the ID is missing on the buyer or the group on the product, the general lot size applies.

You will also find the format for this in the interfaces documentation at [doku.websale.de/schnittstellen](https://doku.websale.de/schnittstellen).

### Step 3: Extending the templates (optional)

On the product detail view `ws_product.htm`, you use this to output a hint about the individual lot size. The second block shows the stored groups as raw data and is only intended for testing.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
...
{PR-GroupIDUnitFactorActive}
   Für Sie wurde folgende individuelle Stückelung definiert: ~PR-UnitFactor~ ~PR-Unit~
{/PR-GroupIDUnitFactorActive}

{PR-UnitFactorGroups}
   Hinterlegte Stückelung (Rohdaten): ~PR-UnitFactorGroups~
{/PR-UnitFactorGroups}
...
```

The raw data has the format `<g><1>GroupID</1><2>Menge</2></g>`, one block per group.

On the shopping cart page `ws_basket.htm`, the corresponding tags are available with the `BASKET-` prefix.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
...
{BASKET-PR-GroupIDUnitFactorActive}
   Für Sie wurde eine individuelle Stückelung definiert.
{/BASKET-PR-GroupIDUnitFactorActive}

{BASKET-PR-UnitFactorGroups}
   Hinterlegte Stückelung (Rohdaten): ~BASKET-PR-UnitFactorGroups~
{/BASKET-PR-UnitFactorGroups}
...
```

### Step 4: Set the message for the ordering process

A buyer can place a product in the shopping cart and only log in afterwards. Only with the login does the shop know their lot size, and the already chosen quantity may then no longer match. The order can then not be completed.

For this case, set the `UserUnitFactorError` parameter in the `shop.config` in the `<NotifyMessages-Txt>` section.

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<NotifyMessages-Txt>
   ...
   UserUnitFactorError = Das Produkt kann in der gewünschten Menge leider nicht bestellt werden.
                         Für Sie wurde eine kundenindividuelle Stückelung hinterlegt.
                         Bitte entfernen Sie das Produkt aus dem Warenkorb und wählen Sie es unter
                         Beachtung der angezeigten Stückelung erneut aus.
   ...
</NotifyMessages-Txt>
```

Reference: Section NotifyMessages-Txt&#x20;

The customer-specific lot size is now fully integrated.


## Related topics

- [Shopping basket and order process](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/warenkorb-und-bestellprozess.md)
- [Adding products via voucher](https://dokumentation.websale.de/en/v8s/gutscheine-anbieten/produkte-mittels-gutschein-zusteuern.md)
- [Texts and messages](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/texte-und-meldungen.md)
- [Order data overview](https://dokumentation.websale.de/en/v8s/materialien/uebersicht-bestelldaten.md)
- [Materials: direct order](https://dokumentation.websale.de/en/v8s/materialien/materialien-direktbestellung.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.