Magento\Sales\Model\Order\ShipmentRepository how can i check the shipping method in this repository?


You can not get shipping Method Info from Magento\Sales\Model\Order\ShipmentRepository. You have to use Magento\Sales\Api\OrderRepositoryInterface.

You can get Order id from ShipmentRepository and after that Get Order Shipping methof information using OrderRepositoryInterface::get($orderId)


        $id = 1;
     * $this->shipmentRepository instead of \Magento\Sales\Model\Order\ShipmentRepository
    $shipment =$this->shipmentRepository->get($id);
    $orderId = $shipment->getOrderId();
         * $this->orderRepository instance of \Magento\Sales\Api\OrderRepositoryInterface
        $order = $this->orderRepository->get($orderId);
        $shippingDescription = $order->getShippingDescription();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.