function commerce_physical_order_shippable in Commerce Physical Product 7
Determines whether or not an order should be considered shippable.
Parameters
commerce_order $order: The order object whose shippability should be determined.
Return value
bool Boolean indicating whether or not the given order is shippable; defaults to FALSE unless any line item on the order is determined to be shippable.
1 call to commerce_physical_order_shippable()
- commerce_physical_rules_order_is_shippable in ./
commerce_physical.rules.inc - Rules condition: check if the order contains shippable products.
File
- ./
commerce_physical.module, line 346 - API for working with physical product types in Drupal Commerce.
Code
function commerce_physical_order_shippable($order) {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$shippable = FALSE;
// Loop over all the line items on the order.
foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
// Mark the order as shippable if the current line item is determined to be
// shippable.
if (commerce_physical_line_item_shippable($line_item_wrapper
->value())) {
$shippable = TRUE;
}
}
// Allow other modules to alter the shippability of the line item.
drupal_alter('commerce_physical_order_shippable', $shippable, $order);
return $shippable;
}