Magento 1 :
1 2 3 4 5 6 |
//get shipping method Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod() //get shipping descriptions Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingDescription(); //get shipping data Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getData(); |
Magento 2 :
You can do this by calling the MagentoCheckoutModelSession. Add it to your constructor and get it by using this code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
protected $_checkoutSession; public function __construct( \Magento\Checkout\Model\Session $checkoutSession ){ $this->_checkoutSession = $checkoutSession; } //call you code in the methos somewehre like this : //get shipping method $this->_checkoutSession->getQuote()->getShippingAddress()->getShippingMethod(); //get shipping descriptions $this->_checkoutSession->getQuote()->getShippingAddress()->getShippingDescription(); //get shipping data $this->_checkoutSession->getQuote()->getShippingAddress()->getData(); |
Or you can get by Object Manager Instance by using this code :
1 2 3 4 5 6 7 8 9 10 |
//Get Object Manager Instance $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); //Get checkout Session by Object Manager Instance $checkoutSession = $objectManager->create('\Magento\Checkout\Model\Session'); //get shipping method $checkoutSession->getQuote()->getShippingAddress()->getShippingMethod(); //get shipping descriptions $checkoutSession->getQuote()->getShippingAddress()->getShippingDescription(); //get shipping data $checkoutSession->getQuote()->getShippingAddress()->getData(); |
Thank for reading this post, Hope it helps.