---
title: "WooCommerce Shipping Rules: Charge Different Rates by Cart Total"
url: "https://wicky.co/woocommerce-shipping-rules-charge-different-rates-by-cart-total/"
type: "post"
published: "2025-10-06T16:57:10-04:00"
modified: "2025-10-06T16:57:10-04:00"
author: "wicky"
---

Learn how to set up multiple shipping rates in WooCommerce based on your customers’ cart totals. I’ll show you 3 different free ways to pull this off in WooCommerce.

[Flexible Shipping Plugin](https://wordpress.org/plugins/flexible-shipping/)

[Code Snippets Plugin](https://wordpress.org/plugins/code-snippets/)

**Timestamps:**

- 0:00 Shipping Zone Demo
- 0:50 Native Shipping Zones
- 3:06 How to NOT set up Shipping Zones
- 6:32 Flexible Shipping Plugin
- 11:02 Custom Code Snippet

## Code Snippet

```

					add_action('woocommerce_cart_calculate_fees', 'custom_dynamic_shipping_rate');
function custom_dynamic_shipping_rate() {
    if (is_admin() && !defined('DOING_AJAX')) return;

    // Remove any existing custom fees
    WC()->cart->fees_api()->remove_all_fees();

    $cart_total = WC()->cart->get_subtotal();
    $shipping_label = '';
    $shipping_cost = 0;

    if ($cart_total  0) {
        WC()->cart->add_fee($shipping_label, $shipping_cost, true);
    } else {
        // Add a free shipping "label" with zero cost
        WC()->cart->add_fee($shipping_label, 0, false);
    }
}

```
