Set a minimum order amount for WooCommerce orders
It is not uncommon for store owners to have the need to set a minimum order amount before any order can be completed. This can be due to handling, processing and/or shipping costs making the sale unprofitable. Today we’re going to add a small snippet to our theme which will allow store owners to set a minimum order amount for all their orders.
Install and activate a child theme
As always the first step on our process here is to create and install a child theme. If you are using one of our themes you can easily grab its child theme from our downloads section. If not, you can read our beginner’s guide on child themes to create your own. This step is essential in order to preserve our changes throughout theme updates.
Add the code to set the minimum order amount
In line 6 above you can customize the minimum order amount. With the code in place the user will get a notice on the cart page regarding the minimum order amount if their order does not exceed it. Furthermore if they proceed to the checkout and try to place the order they will be presented with the same error notice regarding the minimum order amount.
Wrapping up
This quick guide has helped us set a minimum order amount, orders below that amount will get a notice informing the customers that they need to increase their cart total otherwise they won’t be able to proceed with order placement. Let us know if this guide has helped you on your WooCommerce based store, and interesting ideas you might have for future guides in the comments below.
One response to “Set a minimum order amount for WooCommerce orders”
This takes in the acount taxes and delivery.
If you want to calculate based on product value in the cart, then replace total to subtotal in the code
if ( WC()->cart->subtotal cart->subtotal ),