Set a Minimum WooCommerce Order Amount Before Checkout
Prevent checkout until the cart reaches a configurable minimum subtotal, with a clear message on the cart and checkout pages.
A minimum order rule can protect margins when packing or delivery costs make very small orders uneconomical. This example requires a cart subtotal of at least $25 before checkout and blocks checkout processing if the customer tries to bypass the cart notice.
Add it to a child theme’s functions.php file or a code snippets plugin.
The snippet
function my_site_minimum_order_amount() { return 25;}
function my_site_cart_meets_minimum() { if ( ! WC()->cart ) { return true; }
// Product subtotal excludes shipping, fees, and tax. return (float) WC()->cart->get_cart_contents_total() >= my_site_minimum_order_amount();}
add_action( 'woocommerce_check_cart_items', function() { if ( my_site_cart_meets_minimum() ) { return; }
$minimum = wc_price( my_site_minimum_order_amount() ); wc_add_notice( sprintf( /* translators: %s is the formatted minimum order amount. */ __( 'Please add more items. Your order must be at least %s before checkout.', 'my-site' ), $minimum ), 'error' );} );Choose the amount basis carefully
This version uses get_cart_contents_total(), so the threshold is based on products after item-level discounts and before shipping, fees, and tax. If your policy is based on the customer’s final payable total, use $cart->get_total( 'edit' ) instead, but remember that shipping and tax can vary by destination.
The cart check runs whenever WooCommerce validates cart contents, including checkout requests. Because it adds an error notice on the server, WooCommerce prevents the order from being submitted until the threshold is met.
For different minimums by role, currency, or shipping country, calculate the amount inside my_site_minimum_order_amount() and return the appropriate value. Always format the displayed amount with wc_price() so the store currency and decimals are respected.
You can combine this checkout gate with an automatic item-count or role-based discount and conditional shipping methods. Keep the customer-facing rule consistent with the store’s WooCommerce product and cart settings.