How to set minimum order amount in Woocommerce ?

In this tutorial we’ll learn how to set minimum order amount in woocommerce. By default in woocommerce you can order upto any amount but sometimes you need to limit the customer’s purchases to a limit. We can achieve this quite easily.

Place the following lines of code at the end of your functions.php file.

add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
                global $woocommerce;
                $minimum = 50;
                if ( $woocommerce->cart->get_cart_total() < $minimum ) {
           $woocommerce->add_error( sprintf( 'You must have an order with a minimum of %s to place your order.' , $minimum ) );

Replace the value of variable 50 with the amount you want to set as your minimum limit.

You can access functions.php here:

woocommerceSave the file after placing code.

Now when the user try to checkout having cart amount less than minimum limit they’ll receive this error.


About the author

We provide WordPress & WooCommerce Support, Maintenance and Development Services.
2 Responses

Leave a Reply