🎉 Black Friday Month Deal: Save 20% on Premium Bundles! Create Unlimited Shipping Scenarios with ease. Don’t hesitate—offer ends November 30th 🚀 Learn more →
In this article, I’ll show you how to set max weight in WooCommerce orders so you don’t overpay for your shipping. As a bonus, I’ll give you a different solution – setting up weight based shipping with the free plugin.
Sometimes as a WooCommerce store owner, you want to limit your orders. Shipping heavy products or big orders can cost you a lot. In this case, you can just set max weight in WooCommerce orders.
The simplest solution would be to add function to your store. You can copy and paste this code into your theme’s functions.php file.
In wc_add_notice section (line 7) you can edit or remove notice that will appear in customers card if it’s content weight would be higher than the set limit. You can set the limit on line 6.
If you don’t want to overpay for shipping heavy products you can also set up weight based shipping and charge your customers for heavy orders. It’s really simple. All you need is a free version of the Flexible Shipping plugin.
The best Table Rate Shipping for WooCommerce. Period. Create shipping rules based on weight, order totals or item count.
Go to WordPress.org or Download for freeFlexible Shipping is a very popular table rate shipping plugin with more than 245,546 stores using it on a daily basis. In the free version, you can set shipping rates based on price and weight. It also gives you an option to adjust free shipping for your customers.
To charge your clients for heavy shipping, download and install the Flexible Shipping plugin. Then, go to WooCommerce → Settings → Shipping and choose the shipping zone in which you want to add weight based shipping or make a new one.
The next step is to add the shipping method and choose Flexible Shipping method as in the screenshot below.
Now, edit that shipping method. Enable it and enter Method Title and Method Description. To set weight based shipping click on Add rule button.
For every rule, in Based on field, choose Weight and set weight range. In this example, I’ll charge $20 for every 20 kilograms of order’s weight.
And that’s it! Of course, you can do it more efficient with the PRO version of Flexible Shipping plugin with progressively increasing weight based shipping, but I still think that it’s a better solution then to set max weight in WooCommerce orders. It’s a win-win situation – clients are not limited and you don’t overpay for shipping.
But what about customers whose shopping cart weight exceeds the acceptable threshold? By default, they will get a message about the lack of available shipping methods. In most cases, this will result in cart abandonment or, at best, a desperate search to contact the store. However, a much better solution is to replace the default message with your own message. WooCommerce does not allow such an option, but fortunately, there is a simple and free solution for this – Shipping Notices plugin. It allows you to replace the default “No shipping found” notice with your custom text. You can even decide where the notice should be displayed: cart, checkout, or both of them.
Get Free Shipping Notices Plugin →
This way you can easily add information about the maximum allowable weight for shipping or put your contact information there for a customized shipping quote. This simple solution can save many orders.
Sometimes you don’t want to or can’t offer your customers unlimited order weight. In this case you can set max weight in WooCommerce orders. But if you don’t want to overpay for shipping you can set weight based shipping with free Flexible Shipping plugin.
I’m not quite sure how old this is, but I am wondering with this bit of code, will it also prohibit someone from checking out if the cart exceeds the allowable amount/? Or will it just display the notice?
Thanks!
Dan
Hi Dan, using the snippet above will result in displaying the following error notice in the cart: [Image no longer available] and preventing the customer from reaching the checkout page.
There is syntax error on the spacing of the code. Could you please help what should i do with it?
These are my codes:
add_action(‘woocommerce_check_cart_items’,’check_cart_weight’);
function check_cart_weight(){
global $woocommerce;
$weight = $woocommerce->cart->cart_contents_weight;
if( $weight > 30 ){
wc_add_notice( sprintf( __( ‘Youhave %sKg weight and we allow only 30Kg of weight per order; Please split your order into a few purchases. Thank you for your kind understanding.’, ‘woocommerce’ ), $weight ), ‘error’ );
}
}
Hi Customer Care, I believe the syntax error you’ve mentioned is related to the fact you are using the incorrect quotation marks in the snippet above. Please try using ” instead of ‘’.
Hi Lukasz
Thank you for your email.
Can you advise whether i can allow self pick up even it is more than 30kg?
How should the code look like?
Regards
Michelle Lee
Hi Michelle, I believe in such case you can simply add the default WooCommerce Local Pickup shipping method which would be available all the time for all the orders, no matter what’s their weight.
Hi,
is there possibility to modify this code to work with shipping classes? I have 3 shipping classes, and for each of them I want to set different weight limits. Is this possible?
Hi Manx, the shipping classes are supported and this feature is available by default in our Flexible Shipping PRO plugin.