The Min/Max Quantity module enforces minimum and maximum purchase quantities per product or per variation. Validation happens on both the frontend (input constraints) and the server (cart validation hooks), so customers cannot bypass the limits.
Use Cases
- Wholesale pricing — Require minimum order quantities (e.g., “Minimum 10 units”)
- Limited inventory — Cap purchases to prevent hoarding (e.g., “Maximum 2 per customer”)
- Bundle requirements — Enforce quantities that match pack sizes (e.g., step of 6)
- Fair access — Limit popular items during high-demand periods
Enabling the Module
- Go to Fluent Cart > GT Extensions.
- Toggle on Min/Max Quantity.
- Set default minimums and maximums.
- Click Save Settings.
Settings
Global defaults:
- Default Min — Minimum quantity for all products. Default: 1.
- Default Max — Maximum quantity for all products. Default: 0 (0 means no limit).
Display options:
- Show Limits Text — Display the limits below the price on product pages. Default: Yes.
- Enforce on Cart — Validate quantities when the cart is updated (not just on add). Default: Yes.
Message templates:
- Min Text — Text shown on product pages. Default:
Minimum: {min}. - Max Text — Text shown on product pages. Default:
Maximum: {max}. - Min Error — Error message when quantity is below minimum.
- Max Error — Error message when quantity exceeds maximum.
Per-Variation Limits
Beyond the global defaults, you can set limits for individual variations:
- Edit a product in Fluent Cart.
- In the pricing section, each variation now shows Min Quantity, Max Quantity, and Quantity Step fields.
- Set the values and save. These override the global defaults for that specific variation.
Variation-level limits are stored in the variation’s other_info JSON field:
min_quantity— Minimum for this variationmax_quantity— Maximum for this variationquantity_step— Step increment (e.g., step of 5 means quantities of 5, 10, 15, etc.)
How Validation Works
Frontend validation:
The module injects JavaScript that sets HTML5 input attributes on quantity fields:
<input type="number" min="5" max="50" step="5" value="5">
When a customer changes the quantity, the script validates immediately and shows a brief error message (3 seconds) if the value is out of range.
Server-side validation:
Two hooks enforce limits on the server:
fluent_cart/cart/validate_add(priority 10) — Checks quantity when adding to cartfluent_cart/cart/validate_update(priority 10) — Checks quantity when updating cart
If validation fails, the hook returns a WP_Error object with a descriptive message. The cart operation is rejected and the error message is shown to the customer.
The server-side check also respects available stock. If a product has 8 units in stock and the configured maximum is 50, the effective maximum becomes 8.
Display on Product Pages
When Show Limits Text is enabled, the limits appear below the price (hooked at priority 20 on fluent_cart/product/after_price):
<div class="gtfc-quantity-limits">
<span class="gtfc-min-qty">Minimum: 5</span>
<span class="gtfc-max-qty">Maximum: 50</span>
</div>
If only a minimum is set (max = 0), only the minimum text appears, and vice versa.
REST API
POST /wp-json/gt-extensions-fluentcart/v1/variation/{id}/quantity-limits
Updates the quantity limits for a specific variation. Requires manage_options capability.
Parameters:
min_quantity(int)max_quantity(int)quantity_step(int)
{
"success": true,
"limits": {
"min_quantity": 5,
"max_quantity": 50,
"quantity_step": 5
}
}
Quantity Step
The step value controls the increment. If step is set to 6, the quantity input allows 6, 12, 18, 24, etc. This is useful for products sold in packs or cases.
The step is enforced both in the HTML input element and in the server-side validation. A quantity that doesn’t align with the step is rejected.