# Order constraints (MOQ & max)

Order constraints let you enforce minimum and maximum quantity requirements for B2B orders placed through the Variant Drawer.

***

## Available constraints

### MOQ per variant

**Field:** `moqPerVariant`

Sets the minimum quantity a customer must order for each individual variant they select. If a customer adds a variant to the order, they must add at least this many.

| Setting | Behavior                                               |
| ------- | ------------------------------------------------------ |
| `0`     | No minimum per variant (default)                       |
| `2`     | Customer must order at least 2 of any variant they add |
| `5`     | Customer must order at least 5 of any variant they add |

**Example:** With MOQ per variant = 2, a customer ordering a T-shirt in "Red / M" must order at least 2. They can skip "Red / L" entirely, but if they add it, they must add at least 2.

***

### MOQ per product (total)

**Field:** `moqPerProductTotal`

Sets the minimum total quantity across all variants combined. The customer can distribute the quantity however they like across variants, as long as the total meets the minimum.

| Setting | Behavior                                                  |
| ------- | --------------------------------------------------------- |
| `0`     | No total minimum (default)                                |
| `10`    | Customer must order at least 10 total across all variants |
| `50`    | Customer must order at least 50 total across all variants |

**Example:** With MOQ total = 10, a customer could order 3 Red/M + 3 Red/L + 4 Blue/S = 10 total. Any combination that sums to 10 or more is valid.

***

### Max qty per variant

**Field:** `maxQtyPerVariant`

Sets the maximum quantity allowed for any single variant. Prevents customers from over-ordering a specific size or color.

| Setting | Behavior                                           |
| ------- | -------------------------------------------------- |
| `0`     | No upper limit (default)                           |
| `100`   | Customer can order up to 100 of any single variant |
| `500`   | Customer can order up to 500 of any single variant |

***

## Validation behavior

When constraints are configured, the Variant Drawer enforces them in real time:

1. **MOQ notice** — A highlighted notice appears at the top of the drawer body showing the minimum requirements (e.g. "Min 2 per variant. Min 10 total.").
2. **Submit validation** — The action buttons (Add to Cart / Start Order) validate constraints before submitting. If the order doesn't meet requirements, a validation message appears in the footer.
3. **Stepper limits** — The quantity stepper respects the max qty per variant setting. Customers cannot increment beyond the maximum.

***

## Combining constraints

You can use all three constraints together. For example:

| Constraint      | Value | Effect                              |
| --------------- | ----- | ----------------------------------- |
| MOQ per variant | 2     | Each added variant needs at least 2 |
| MOQ total       | 12    | Must order 12+ total                |
| Max per variant | 50    | No single variant can exceed 50     |

This setup means: order at least 12 items total, with at least 2 per variant you include, and no more than 50 of any single variant.

> **Note:** If MOQ per variant is greater than Max per variant, a warning appears in the editor: "Min must be less than or equal to max."

***

## Setting up constraints

1. Open the Variant Drawer rule in the editor
2. Navigate to **Order Constraints** in the left sidebar
3. Set the desired values (leave at 0 to disable any constraint)
4. The live preview shows the MOQ notice banner in the drawer
5. Click **Save**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://orbit-b2b.gitbook.io/orbit-b2b-docs/variant-drawer/order-constraints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
