Title: Maximum order amount
Last modified: March 25, 2017

---

# Maximum order amount

 *  [knientje](https://wordpress.org/support/users/knientje/)
 * (@knientje)
 * [9 years ago](https://wordpress.org/support/topic/maximum-order-amount/)
 * I already found this for minimum order amount:
 *     ```
       add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
       add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
   
       function wc_minimum_order_amount() {
           // Set this variable to specify a minimum order value
           $minimum = 1;
   
           if ( WC()->cart->total < $minimum ) {
   
               if( is_cart() ) {
   
                   wc_print_notice( 
                       sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' , 
                           wc_price( $minimum ), 
                           wc_price( WC()->cart->total )
                       ), 'error' 
                   );
   
               } else {
   
                   wc_add_notice( 
                       sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' , 
                           wc_price( $minimum ), 
                           wc_price( WC()->cart->total )
                       ), 'error' 
                   );
   
               }
           }
   
       }
       ```
   
 * Just copy the above scrtpt changing “minimum” by “maximum” and setting $maximum
   =104 didn’t work.
 * But I want as well a minimum as a maximum order amount. So what do I add?

Viewing 1 replies (of 1 total)

 *  [kursora](https://wordpress.org/support/users/kursora/)
 * (@kursora)
 * [9 years ago](https://wordpress.org/support/topic/maximum-order-amount/#post-8964171)
 *     ```
       add_action( 'woocommerce_checkout_process', 'wc_maximum_order_amount' );
       add_action( 'woocommerce_before_cart' , 'wc_maximum_order_amount' );
   
       function wc_maximum_order_amount() {
           // Set this variable to specify a maximum order value
           $maximum = 104;
   
           if ( WC()->cart->total > $maximum ) {
   
               if( is_cart() ) {
   
                   wc_print_notice( 
                       sprintf( 'You must have an order with a maximum of %s to place your order, your current order total is %s.' , 
                           wc_price( $maximum ), 
                           wc_price( WC()->cart->total )
                       ), 'error' 
                   );
   
               } else {
   
                   wc_add_notice( 
                       sprintf( 'You must have an order with a maximum of %s to place your order, your current order total is %s.' , 
                           wc_price( $maximum ), 
                           wc_price( WC()->cart->total )
                       ), 'error' 
                   );
   
               }
           }
   
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Maximum order amount’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [kursora](https://wordpress.org/support/users/kursora/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/maximum-order-amount/#post-8964171)
 * Status: not resolved