You are here

function uc_cart_is_shippable in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart/uc_cart.module \uc_cart_is_shippable()
  2. 7.3 uc_cart/uc_cart.module \uc_cart_is_shippable()
6 calls to uc_cart_is_shippable()
uc_cart_checkout_form in uc_cart/uc_cart.module
uc_cart_checkout_review in uc_cart/uc_cart.module
Allow a customer to review their order before finally submitting it.
uc_checkout_pane_billing in uc_cart/uc_cart_checkout_pane.inc
Get the billing information.
uc_checkout_pane_delivery in uc_cart/uc_cart_checkout_pane.inc
Get the delivery information.
uc_paypal_ec_checkout in payment/uc_paypal/uc_paypal.module

... See full list

File

uc_cart/uc_cart.module, line 2079

Code

function uc_cart_is_shippable($cart_id = NULL, $action = '') {
  static $shippable;
  if ($action != 'refresh' && ($shippable === FALSE || $shippable === TRUE)) {
    return $shippable;
  }
  $shippable = FALSE;
  $items = uc_cart_get_contents($cart_id);

  // Return FALSE if the cart is empty!
  if (empty($items)) {
    return FALSE;
  }
  foreach ($items as $item) {
    $result[] = uc_cart_product_is_shippable($item);
  }

  // Return TRUE if any product in the cart is shippable.
  if (in_array(TRUE, $result)) {
    $shippable = TRUE;
    return TRUE;
  }
  return FALSE;
}