Create Free Shipping WooCommerce Coupon (Fixes Free Shipping Not Working Issue)

First step is to add a Free Shipping Coupon. Go to the WP admin area, hover over WooCommerce and click Coupons. Click Add Coupon on the next page and give the coupon a title. Select a discount type (Cart % Discount) and tick Allow free shipping.

Add New WooCommerce Coupon

Head over to WooCommerce > Settings and click the Shipping tab. You should go to the shipping zones automatically. Click the Add Shipping Zone button in the bottom right. Give the new shipping zone a new name like Free Shipping and set the region to your region (I chose United States) or leave it blank to automatically choose Everywhere.

Next, hover over the title of the shipping zone you just created and click View. On the page that you are taken to, click Add Shipping Method. Select Free Shipping from the dropdown that appears and click Add Shipping Method.

Hover over the title of the shipping method you just created and click Settings. Select “A minimum order amount AND a coupon” option from the dropdown and enter 0 as the minimum amount. Why? WooCommerce is glitchy, and if you only select “A valid coupon”, the free shipping coupon may not work for you.

Add Free Shipping Method WooCommerce

Next, add this following code snippet to your functions.php file.

/**
 * Hide shipping rates when free shipping is available.
 * Updated to support WooCommerce 2.6 Shipping Zones.
 *
 * @param array $rates Array of rates found for the package.
 * @return array
 */
function my_hide_shipping_when_free_is_available( $rates ) {
    $free = array();
    foreach ( $rates as $rate_id => $rate ) {
        if ( 'free_shipping' === $rate->method_id ) {
            $free[ $rate_id ] = $rate;
            break;
        }
    }
    return ! empty( $free ) ? $free : $rates;
}
add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );

The last step is to test out your coupon to see if it works. Test it by adding an item to your cart. Click View Cart and type in morefreeshipping into the input box that says Apply Coupons. Click the buttons, and it should remove any shipping costs.