What logic is built into the quantity rules?
The WooCommerce Quantity Manager plugin lets you set advanced rules regarding the product quantities in your store. You can set minimum and maximum quantities, values, set quantity increments, change the default quantity, and more. This article provides in-depth information about how these rules work together, and the complex logic that is built into the plugin behind the scenes.
If multiple rules apply to a product or variation, then WooCommerce Quantity Manager will use the lowest level (i.e. most specific) rule.
- Category-level rules override global rules.
- Sub-category rules override parent category rules
- Product-level rules override category rules.
- Variation-level rules override product rules.
- If you have a global minimum quantity of 5 and set a product-level minimum quantity of 1, then you can place an order with fewer than 5 products if you only buy this product.
- If you have a global minimum quantity of 3, a category minimum of 5 and a product minimum of 1, then you can buy up to 5 products from that category. However, this can only include 1 of the product that has a minimum quantity of 1.
Combining different types of rule
The different types of rule in WooCommerce Quantity Manager are designed to work together seamlessly, without conflicting with one another.
- If you set a minimum quantity of 3 and step values of 5 then the quantity field will display 5 by default.
- Quantity rules override the default quantity, e.g. if you set a default quantity of 5 and a minimum quantity of 10 then the quantity field will display 10 by default.
If you are managing stock in your WooCommerce store and backorders are disabled, then customers might try to add products to the cart which satisfy the minimum quantity rule/value, but there is not enough stock. In this case, then the minimum quantity rules/values will be ignored and WooCommerce itself will display errors about the product being out of stock.
If the default quantity or the lowest possible quantity increment is higher than the number of items in stock, then the current stock level will appear as the default quantity. This ensures that the default quantity will always show a quantity that can actually be purchased.
- If the quantity is 5 but only 3 are in stock, then the default quantity will appear as 3.
- If there is a quantity increment of 5 and only 3 are in stock, then the product will show as out of stock.
What happens if a product is in two categories with different quantity rules?
If a product is in two unrelated categories with conflicting quantity rules, then the plugin will use the rule from the first category. The order of categories is determined alphabetically based on the category name.
If the product is in a sub-category where the parent category rules conflict with the sub-category rules, then the sub-category rules will take precedence.