Videos

Calculating shipping by weight of items in cart

Date Published: 
12/17/2011
Duration: 
18:33

This (raw) screencast shows how to calculate shipping based on weight of items in the order.
We add a weight field to the product, and then create a "calculation rule" for shipping that walks the line items on the order, checks to see which items have a weight, and for each of those adds more to the price of the shipping line item.
I've posted the result of this as a little feature module, drupal.org/sandbox/rfay/1374058
It was inspired by the questions at drupalcommerce.org/node/1721

Comments

jbeall1369 on April 2, 2013

When I “set a data value” at 9:03 minutes in, I can set the data value to “shipping-for-line-item,” but I can’t put the “line-item-calculated-shipping-cost” into the “Data Selector.” I doubled checked everything and my “provider” is set just like yours. Do you have any idea why I might have trouble with my Data Selector? However, if I add another action, Calculate a Value, and the Data value and Data Selectors pop up like yours does for the “Set a Value Action.”

Harsha Sathyanarayana on December 1, 2014

Hey guys, I had the same problem, The solution is to select the decimal instead of Integer, when you are creating the rule(Component), if you have already created the rule you can edit it in the settings tab. I guess thats why you are not able to select "line-item-calculated-shipping-cost" since the data type wont match.