Offering free shipping is the best way to encourage shoppers to spend more money in your store, but some products just don’t have enough profit margin to make that possible. Nevertheless, you might still want to offer a shipping cost discount to high-spending customers.

There are, of course, table rate shipping plugins that can do this task quite easily. But if you don’t want to switch to a different (probably expensive) shipping rate plugin, or are content to use WooCommerce’s built-in shipping rate functionality, it’s actually quite easy to add shipping discount rules with a little bit of code.

The below code checks whether the cart subtotal is greater than $99, and if it is, it knocks a flat $10 off the shipping cost. You can also do percentage discounts by replacing the subtraction with a multiplication—for example “$cost * 0.5” to discount shipping by 50%.

function launchwoo_adjust_shipping_rate( $rates ) {

    $cart_subtotal = WC()->cart->subtotal;

    // Check if the subtotal is greater than $99
    if ( $cart_subtotal >= 99 ) {

        // Iteratethrough each shipping rate
        foreach ( $rates as $rate ) {

            // Variable to hold previous cost value so we can do sums against it
            $cost = $rate->cost;

           // Discount rate by $10.00
           // This is the most we're prepared to give away free
           $rate->cost = $cost - 10;

           //Make sure no negative values are passed
            if ($rate->cost < 0) {
                $rate->cost = 0;

    return $rates;
add_filter( 'woocommerce_package_rates', 'launchwoo_adjust_shipping_rate', 10 );

To use this code, just add it to your theme’s Functions.php file or to a MU Plugin.

Advanced: If you want to be very clever, you can have multiple cart subtotal checking conditionals to apply different discount levels. Maybe knock a further $10 off if the customer spends over $200, for instance. You can also go the other way and charge more shipping if the customer spends under a certain amount.

Leave a Reply