Woocommerce: How to Set Purchase Amount Limit on Your Cart

Normally you won’t limit how much can your customer spend in your store. But somehow, for some reason, there are people want to limit the total amount of purchase in a store. Yes, I have encountered one. My client want to set a purchase limit in his Woocommerce site.

There already have plugins that can set maximum/minimum limit for the number of items that can be added to the cart, for each product, per order. But I didn’t found one that can limit the purchase amount, maybe there are, but I might have missed it.

Anyway, here is the solution that I come up with to set WooCommerce Purchase Amount Limit, with the help of `woocommerce_check_cart_items` action hook.

Woocommerce Set Cart Total Limits:

add_action( 'woocommerce_check_cart_items', 'customer_purchase_limit_check' );
function customer_purchase_limit_check(){
   if( is_cart() || is_checkout() ) {
       $maxamount = 10000;
       $cart_total = WC()->cart->total;
       if($cart_total > $maxamount ){
          wc_add_notice('You have exceeded the purchase limt ($100000) in a single order. Please try to edit your cart.', 'error');

This method can be apply to set the limit of total weight as well.

Woocommerce Set Cart Weight Limits:

add_action( 'woocommerce_check_cart_items', 'customer_purchase_weight_limit_check' );
function customer_purchase_weight_limit_check(){
     if( is_cart() || is_checkout() ) {
        $maxweight = 500;
        $cart_weight = WC()->cart->cart_contents_weight;
        if($cart_weight > $maxweight ){
            wc_add_notice('You cart is too heavy too ship.', 'error');


As you can see, this `woocommerce_check_cart_items`  can be use for validation. Which means you can add any kind of validation ‘Add To Cart’ action has been called.

Leave A Comment