total weight in rules

I have physical and commerce_physical installed and finally got Shipping Flat Rate going and now I need to make rules that apply a rate between certain total weight limits (0-1kg so much 1-2kg so much etc. ). How do you create a condition for this?

Posted: Nov 16, 2011


nrackleff on February 2, 2012

I need to use this too so I can calculate which rate/service to apply based on the total weight of the cart.
- My client uses UPS shipping for up to 150lbs.
- Flat rate by state between 150 and 1000lbs.
- Free shipping for over 1000 lbs.

I have watched Randy's screencast on calculating shipping by weight and it is excellent, but it doesn't do what I need. I believe I need to get the total shipping weight to show up in the list of data elements that you can make a comparison on, like the total order amount does with commerce-order:commerce-order-total:amount. I need this, but for weight.

Thanks for any help provided.

pushka on February 2, 2012

Apply the patch here to Commerce Physical Product module : http://drupal.org/node/1344962#comment-5261936

Then you can set up a shipping service for each weight bracket (e.g. 0-1kg, 1-2kg) with corresponding cost.

The patch enables you to easily add conditions to each service (e.g. total weight < 1kg and NOT weight < 2kg).

That's it! Note that the patch only handles kg right now.

Patroclas on February 4, 2012

I know this will not be understood by everyone, but can we please have a way to get a version of the patched module without having to use Patch?

If you need more explanation of my first statement, using Patch in a Windows environment is really next to impossible. And yes, I do know about CYGWIN and similar utilities but have never found a way to successfully use them (or perhaps I should say I have never found an explanation of how to use them written by someone who can explain for non-geek speakers).

So is there someone out there who can post a patched version of the CPP module please? I would really like to try it.

nrackleff on February 10, 2012

I have installed the patched version and created a condition on my UPS shipping that it only be for weights under 68kg (eg 150lbs.). I add one 50kg item to my cart, with it's product weight actually set in kg, and then proceed to checkout. When I get to the shipping page, I get the following error: Fatal error: Call to undefined function commerce_physical_order_volume() in C:\clients\qualitychain_redesign\trunk\web\sites\all\modules\commerce_ups\commerce_ups.xml.inc on line 33.

If I turn off UPS and just use flat rate with a weight limit, it seems to work fine.

I was also please to find that it appears to be able to do the conversion from pounds to kilograms behind the scenes. For example, I set my weight limits in kg, but all my products are stored in pounds. It seems to be handling the weight correctly even though the products are stored in pounds. Am I just wishful thinking, or is it smart enough to know that?

Thanks for the patch.

rfay Randy Fay on February 10, 2012

Please put your code in a sandbox if you want to share it... so much better! And please put a link here to the issue (I hope) you posted in the issue queue.

salapataras on February 13, 2012


I need some help.

If the total weigth of the order is under the limit of 4Kg, I want the total shipping cost to be 5.5€
else the the shipping cost is as the video example.

Please help me...

firsttimothy415 on April 9, 2013

There is no link to any module with the patch. Can you please include one? I really also need to solve this exact same problem with the tota weight of an order

ianniscamillieri on April 25, 2014

Assuming I already have products with a weight field (in grams).
I successfully applied the commerce_physical module patch.
I've created 2 shipping services according to my needs for the cart total weight threshold (i.e. 1->500g ; 501->1000g) .
Then I've tried to find around where and how to add conditions to each shipping services but didn't find it.
Would someone help me with some basics informations? Is it in the "configure component" link beside the shipping service name (in the store configuration / shipping)? Or is it a general rule?
Thanks for your help.

salapataras on February 17, 2012


I need some help.

If the total weigth of the order is under the limit of 4Kg, I want the total shipping cost to be 5.5€
else the the shipping cost is as the video example.

Please help me...