You are here

function uc_cart_product_is_shippable in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_cart/uc_cart.module \uc_cart_product_is_shippable()

Determines whether a product is shippable or not.

2 calls to uc_cart_product_is_shippable()
uc_cart_is_shippable in uc_cart/uc_cart.module
Determines whether a cart contains shippable items or not.
uc_quote_action_get_quote in shipping/uc_quote/uc_quote.module
Retrieves a shipping quote.

File

uc_cart/uc_cart.module, line 1715

Code

function uc_cart_product_is_shippable($product) {

  // Return FALSE if the product form specifies this as not shippable.
  if ($product->data['shippable'] == FALSE) {
    return FALSE;
  }
  $result = array();

  // See if any other modules have a say in the matter...
  foreach (module_list() as $module) {
    $func = $module . '_cart_item';
    if (function_exists($func)) {

      // $product must be passed by reference.
      $return = $func('can_ship', $product);
      if (!is_null($return)) {
        $result[] = $return;
      }
    }
  }

  // Return TRUE by default.
  if (empty($result) || in_array(TRUE, $result)) {
    return TRUE;
  }
  return FALSE;
}