/** * @return ShippingInterface|null */ public function create() { $shipping = null; if ($this->getOrderId()) { $this->order = $this->orderFactory->create()->load($this->getOrderId()); if ($this->order->getEntityId()) { /** @var ShippingInterface $shipping */ $shipping = $this->shippingFactory->create(); $shippingAddress = $this->order->getShippingAddress(); if ($shippingAddress) { $shipping->setAddress($shippingAddress); } $shipping->setMethod($this->order->getShippingMethod()); $shipping->setTotal($this->getTotal()); } } return $shipping; }
/** * Returns order id * * @return int */ public function getId() { return $this->order->getEntityId(); }