/** * Calculates shipping rates * * @param Cart $cart SHipping cart for which to calculate shipping * @param string $service Service for which to calculate cost (Standard, Priority etc.) * @return float|int */ public function calculateShipping(Cart $cart, $service = NULL) { if($cart->getShippingAddress() == NULL) return 0; $ups_api = new UpsAPI($this); try { $shipping_cost = $ups_api->getRate($cart, $service); } catch(APIException $exception) { $shipping_cost = 0; // TODO Here maybe return something other than 0 } return $shipping_cost; }