# Maximum Order Amount

> Blocks checkout when the cart subtotal goes over a set amount and shows a notice asking the shopper to contact you for large orders.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, cart, limits, checkout
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-maximum-order-amount/

## Code

```php
add_action( 'woocommerce_check_cart_items', function () {
    $maximum = 1000; // Highest subtotal allowed per order.

    $subtotal = (float) WC()->cart->get_subtotal();

    if ( $subtotal > $maximum ) {
        wc_add_notice( sprintf( 'Orders above %s cannot be placed online. Please contact us for a quote.', wc_price( $maximum ) ), 'error' );
    }
} );
```

## Notes

Change $maximum. The check uses the cart subtotal before shipping.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Maximum Order Amount" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
