Sometimes you may want to limit the availability of rates depending on the order value. The WooCommerce Pro Shipping plugin already lets you set up tiered rates by weight, or item quantity, but there’s no way to set a maximum order value for a particular rate. Fortunately there are filters in place that let you achieve that fairly easily. The example below limits a specific rate to a maximum order value of £100 after discounts, including tax – the rate won’t be offered if the cart is worth more than that.

add_filter( 'woo_ps_availability', function ($availability, $rate, $rate_id) {
    // Adjust '1' below to the rate ID to be blocked
    if ( $rate_id == 1 ) {
        // You may need to adjust this depending on whether your threshold is before/after discounts and/or before/after tax
        $total = WC()->cart->get_cart_contents_total() + WC()->cart->get_cart_contents_tax();
        if ( $total > 100) {
            return false;
    return $availability;
}, 10, 3);

This entry was posted in .
Bookmark the permalink.