How to Configure WooCommerce Shipping Methods by Weight
Recently, I’ve been browsing Reddit and found out that some users assume that weight-based shipping can be configured in WooCommerce itself, using its standard settings.
For better or worse, there is no such functionality in WooCommerce out of the box, so we need to install a plugin for that or code everything from scratch.
Below, in this guide, I will show two different scenarios on how we can use the weight of a customer’s cart to either calculate the shipping or to allow specific shipping methods.
Enable or Disable Shipping Methods Based on Weight
Examples in this chapter require the Simple Conditional Shipping and Payments plugin.
Please install and activate the plugin first:

Example 1. Enable free shipping if the total cart weight is less than
For example, let’s say that our goal is to not allow free shipping if the total weight of products purchased by a customer is more than 10kg. This goal can be achieved using two approaches, by the way:
- Approach 1. Create a condition that enables free shipping if the total cart weight is less than a specified amount.
- Approach 2. Create a condition that disables free shipping if the cart weight is more than a specified amount.
Which one to use is up to you and may depend on your situation, by the way. But, as you might get from the heading of this chapter, I am about to show you the first approach.
To configure it, navigate to WooCommerce > Settings > Conditions > Shipping conditions and click the “Add shipping condition” button:

Example 2. Enable a custom shipping method if the cart weight is more than
Let’s say we have already configured a condition from the first example, and free shipping methods are not available if the total cart weight is equal to or more than 10 kg. So, now, let’s enable a specific shipping method only for customers’ carts with a weight of more than 10 kg.
We can do it this way:

Configuring WooCommerce shipping methods by weight programmatically
Recently, I got a feeling that people who land on my blog articles do not look for a programmatic approach; however, let me just show you how to implement it real quick. For example, we can do it programmatically for the first example.
So, the WooCommerce hook we will need to use here is woocommerce_package_rates.
/**
* @snippet WooCommerce Shipping by Weight
* @author Misha Rudrastyh
* @url https://rudrastyh.com/woocommerce/shipping-by-weight.html
*/
add_filter( 'woocommerce_package_rates', 'rudr_shipping_by_weight', 25, 2 );
function rudr_shipping_by_weight( $rates, $package ) {
// let's get the total cart weight
$cart_weight = WC()->cart->get_cart_contents_weight();
// no free shipping if the weight is more than 10kg
if( 10 < $cart_weight ) {
$rates = array_filter( $rates, function( $rate_id ) {
return ! str_starts_with( $rate_id, 'free_shipping:' );
}, ARRAY_FILTER_USE_KEY );
}
return $rates;
}Another way of coding it, which will work for older versions of PHP:
if( 10 < $cart_weight ) {
foreach( $rates as $rate_id => $rate ) {
if( 0 === strpos( $rate_id, 'free_shipping:' ) ) {
unset( $rates[ $rate_id ] );
}
}
}We use str_starts_with() or strpos() function here, because shipping methods have different IDs depending on the shipping zone, and not only, for example free_shipping:3, free_shipping:5, flat_rate:10 and so on.
Calculate Shipping by Weight
Previously, in this article, we only discussed how to enable or disable specific shipping methods in WooCommerce based on customers’ cart weights.
But what if you want to calculate shipping costs dynamically as well?
For example:
- to multiply the cart weight by a specific price,
- to add conditions directly inside the shipping methods in WooCommerce settings.
Here is an example of a custom condition:

Here is an example of dynamic shipping calculation:

[lbs] as well, not a big deal.Would you be interested if I published a plugin for that?
If yes, please let me know in the comments below.
Misha Rudrastyh
Hey guys and welcome to my website. For more than 15 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me