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.

2 thoughts on “Woocommerce: How to Set Purchase Amount Limit on Your Cart


    Hi, thanks for these simple solutions. If we want to specify the max amount for each cart per user basis like allowing them to add to their carts on their own according to their own predefined budgeting, what would you suggest?

    1. tck30

      You will need a field for your to enter his/her budget amount.
      Then in the above codes, change the `$maxamount` to the user budget. Of course, in order to get the user budget, the user must have to logged in first.

Leave A Comment