I would like to get the selected shipping method from the checkout page it looks like this one :

enter image description here

I just want to get the selected shipping method like above image shown : Shipping Table Rates so that I can get the shipping code method.

I have some clue to get it using \Magento\Checkout\Api\Data\ShippingInformationInterfaceFactory but when I add this to my block class I got this error :

Fatal error: Uncaught TypeError: Argument 3 passed to Fabelio\Checkout\Block\ExpectedDelivery::__construct() must be an instance of Magento\Checkout\Api\Data\ShippingInformationInterfaceFactory

Is this the correct way to getting the shipping method from checkout page ?

  • You should remove old files from the var/generation/ directory. Commented Sep 29, 2017 at 13:55
  • @SiarheyUchukhlebau nope not working Commented Sep 29, 2017 at 14:28

1 Answer 1


You can do this by calling the Magento\Quote\Api\Data\ShippingMethodInterface. Add it to your constructor and get it by using this code :

 protected $shippingMethod;

public function __construct(ShippingMethodInterface $shippingMethod){
    $this->shippingMethod = $shippingMethod;

// call you code in the methos somewehre like this : 
$methodTitle = $this->shippingMethod->getMethodTitle();
  • I got null value @GujaratSantana Commented Oct 29, 2020 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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