_carrierFactory = $carrierFactory; } /** * Retrieve detail for shipment track * * @return \Magento\Framework\Phrase|string */ public function getNumberDetail() { $carrierInstance = $this->_carrierFactory->create($this->getCarrierCode()); if (!$carrierInstance) { $custom = []; $custom['title'] = $this->getTitle(); $custom['number'] = $this->getTrackNumber(); return $custom; } else { $carrierInstance->setStore($this->getStore()); } $trackingInfo = $carrierInstance->getTrackingInfo($this->getNumber()); if (!$trackingInfo) { return __('No detail for number "%1"', $this->getNumber()); } return $trackingInfo; } }