function hook_commerce_physical_product_line_item_weight_alter in Commerce Physical Product 7
Allows modules to alter the weight that has been determined for a product line item.
Parameters
&$weight: The weight field value array representing the weight of the product line item, which defaults to the weight of the product times the quantity.
$line_item: The product line item object whose weight is being determined. The product data can be accessed through this line item's commerce_product field.
See also
commerce_physical_product_line_item_weight()
1 invocation of hook_commerce_physical_product_line_item_weight_alter()
- commerce_physical_product_line_item_weight in ./
commerce_physical.module - Determines the weight to use for a product line item on an order.
File
- ./
commerce_physical.api.php, line 40 - Hooks provided by the Commerce Physical Product module.
Code
function hook_commerce_physical_product_line_item_weight_alter(&$weight, $line_item) {
// Add a one pound tare weight to the product for shipping calculation.
$weight['weight'] += physical_weight_convert(array(
'weight' => 1,
'unit' => 'lb',
), $weight['unit']);
}