Skip to main content

Type Alias: SetQuantity

SetQuantity = (quantity) => void

Function

Updates the quantity for price calculations.

This method adjusts the quantity value used for all price calculations in the configurator. It respects product-specific constraints such as minimum order quantities (MOQ) and incremental quantity steps. If the provided quantity doesn't meet these constraints, it's automatically adjusted to the nearest valid value.

The quantity is capped at 99,999, the same maximum as the quantity box. When the product has a step, a larger value becomes the highest step value at or below 99,999 (for example 99,995 with a minimum of 5 and a step of 15). A product minimum above 99,999 is kept.

Quantity changes trigger price recalculations that reflect volume-based pricing tiers, providing accurate pricing for different order volumes.

Parameters​

quantity​

number

The requested quantity value (will be adjusted if needed to comply with product minimum quantities, step increments and the 99,999 maximum)

Returns​

void

Example​

// Set a specific quantity, with automatic adjustment to respect MOQ and steps
window.mimeeqApp.actions.setQuantity(23);

// Connect a quantity input to the configurator
document.getElementById('qty-input').addEventListener('change', (e) => {
window.mimeeqApp.actions.setQuantity(parseInt(e.target.value, 10));
});