Why Add a Minimum Order Amount?

Many WooCommerce stores require a minimum purchase value before allowing checkout. For example:

  • Wholesale stores with bulk order rules
  • Businesses with high shipping costs
  • Stores that want to avoid micro orders

Adding a minimum order rule improves efficiency and ensures profitability.

How It Works

We’ll set a minimum cart amount (e.g., $50). If the cart total is below this value, customers will see a notice and won’t be able to proceed to checkout.

Example message:
“Minimum order amount is $50. Please add more products to your cart.”

PHP Snippet: Enforce Minimum Order Amount

/**
 * @snippet       Minimum Order Amount in WooCommerce
 * @author        Spiderwares
 * @compatible    WooCommerce 8+
 */

add_action( 'woocommerce_checkout_process', 'spiderwares_minimum_order_amount' );
add_action( 'woocommerce_before_cart', 'spiderwares_minimum_order_amount' );

function spiderwares_minimum_order_amount() {
    $minimum = 50; // Set your minimum order amount

    if ( WC()->cart->total < $minimum ) {
        if ( is_cart() ) {
            wc_print_notice(
                sprintf( 'Minimum order amount is %s. Please add more products to your cart.', wc_price( $minimum ) ),
                'error'
            );
        } else {
            wc_add_notice(
                sprintf( 'Minimum order amount is %s. Please add more products to your cart.', wc_price( $minimum ) ),
                'error'
            );
        }
    }
}

CSS Snippet: Style the Notice (Optional)

.woocommerce-error {
    background: #fff5f5;
    color: #c53030;
    border-radius: 6px;
    padding: 10px 15px;
}

Where to Add the Code?

  • Add the PHP code into your functions.php file (or a custom plugin).
  • Add the CSS code into your child theme’s style.css file.