Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

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.

Our team at Themelocation is comprised of WordPress developers of high expertise

  • We can maintain, support and manage your single, or all your clients, website with dedication
  • Our skills are at your disposal.

Book a Call

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.

woocommerce

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

2 thoughts on “How to set minimum order amount in Woocommerce ?”

Leave a Comment

Your email address will not be published. Required fields are marked *