function commerce_physical_line_item_shippable in Commerce Physical Product 7
Determines whether or not a line item should be considered shippable.
Parameters
commerce_line_item $line_item: The line item object whose shippability is being determined.
Return value
bool Boolean indicating whether or not the given line item represents something shippable; defaults to FALSE unless the line item represents a product line item with a discernible weight.
2 calls to commerce_physical_line_item_shippable()
- commerce_physical_order_shippable in ./
commerce_physical.module - Determines whether or not an order should be considered shippable.
- commerce_physical_rules_line_item_is_shippable in ./
commerce_physical.rules.inc - Rules condition: check if the line item is a shippable product.
File
- ./
commerce_physical.module, line 317 - API for working with physical product types in Drupal Commerce.
Code
function commerce_physical_line_item_shippable($line_item) {
$shippable = FALSE;
// If this is a product line item...
if (in_array($line_item->type, commerce_product_line_item_types())) {
// Mark this line item as shippable if we can determine its weight.
$weight = commerce_physical_product_line_item_weight($line_item);
if (!empty($weight)) {
$shippable = TRUE;
}
}
// Allow other modules to alter the shippability of the line item.
drupal_alter('commerce_physical_line_item_shippable', $shippable, $line_item);
return $shippable;
}