This code enables the store owner to set a minimum number of items to be purchased for any simple or variable product in WooCommerce. If the customer order is below the minimum quantity :
- A error message is displayed on the cart page.
- The Proceed to Checkout button is removed until order quantities are increased to the minimum amount.
This code forces the buyer to order the minimum amount otherwise they cannot proceed to checkout.
Shows the Minimum Quantity text field added to both simple products and variable products. When the quantity added to cart to below the minimum, a notice is displayed on the cart page forcing a minimum order amount and removing the proceed to checkout button until the quantity is increased.
Install the zip folder as a new plugin or copy and paste the PHP code from the functions file to the end of your child themes functions file or custom functionality plugin.
Simple Products – Minimum Quantity Limits
To configure quantity limits for a simple product:
- Edit the product.
- Navigate to the Product Data – Simple Product > General tab.
- Set the Minimum Quantity.
Min Qty — Minimum required quantity for this product per order.
Variable Products – Minimum Quantity Limits
To configure quantity limits for a product variation :
- Navigate to Product Data > Variable Product > Variations.
- Locate the variation you need to edit and expand its settings.
- Set the Minimum quantity.
Minimum Quantity — Minimum required quantity for this variable product.
These solutions may also help :