We can get shipping amount from quote object. You can use magento di(dependency injection) or object manager to get the shipping cost from quote session. Here in this tutorial, we are going to explain how you can get cart shipping cost in Mgento 2 from cart session.
Magento 2 get cart Shipping Cost | Amount Example
You can get shipping cost from cart object simply as below-
Example:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); $quote = $cart->getQuote(); $shippingAmount = $quote->getShippingAddress()->getShippingAmount(); |
First get the object manager instance, using object manager to access the Magento Checkout Model Cart object. After getting quote object get shippingAddress object to access the shipping amount.
On the same way you can get other details about shipping.