How to set minimum order amount in WooCommerce

In this article we explain a quickly way to setup minimum order amount in WooCommerce
Graphic design. A young woman with a package with a logo of WooCommerce
Atualizado em 02/10/2025

WooCommerce is one of the most popular e-commerce platforms in the world. It is used by thousands of online stores and offers a plethora of features to help store owners create and manage their stores.

One of the options that online store owners often need to set up is a minimum order amount. This is usually necessary in stores that send the physical product to the customer’s address, preventing purchases for a product of small value whose shipping does not compensate.

In the solution that we present here, it is not necessary to install any plugin, but we recommend using the Code Snippets plugin so that it is possible to insert the code in a simpler and more organized way.

You can also insert the code directly into your child theme’s functions.php file.

<?php
/*
 * WordPress Snippet: WooCommerce minimum order amount 
 * Author: Fellipe Soares
 * Author URI: https://www.amicatek.com/en/
 * Data Criação: Dec 26 2022
 * Data Alteração: Dec 26 2022
*/


function amk_wc_min_order_amount( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
        return;

    if ( WC()->cart->get_cart_contents_total() < 30 ) {
        wc_print_notice( 
            sprintf( 'The minimum amount to finalize the order is $30.00. Your current order is $ %s', 
            WC()->cart->get_cart_contents_total() ), 'error' 
        );
    }
}

add_action( 'woocommerce_check_cart_items', 'amk_wc_min_order_amount' );

Explaining the code: In this snippet we define a minimum value of $30.00 per order as a rule. The script will evaluate if the total cart value is less than 30.00.

If so, it will show a message on the screen informing that the minimum amount to complete the order is $30.00, and also informing the total amount of the order.

If you have any problems applying this script, please use the comments section to let us know.

Oh, if it works, let us know too. We’ll be happy to have helped.

Picture of Fellipe Soares

Fellipe Soares

Bachelor in Information Systems, working with technology for over 15 years in the creation and evolution of applications and systems for companies and businesses.

Leave a Reply

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

Related Articles

Query Fan-Out: How Google’s AI Mode Breaks Down Searches

In my daily work as a technology specialist, I’ve been closely following the transformations that artificial intelligence is bringing to Google. One of the most impactful, without a doubt, is what they call Query Fan-Out. For me, this isn’t just an update, but a true revolution in the way the search engine interprets what we ask. Instead of treating a search as a single question, Google now breaks it down into multiple subqueries. It explores different angles and intentions behind