I am implementing a shipping method for my store. My method is based on the subtotal value so I need to get subtotal value in my module. How can I call subtotal value in magento 2.2?
Asked
Active
Viewed 1,729 times
1 Answers
0
I find the answer by myself, here is how we can call subtotal and use it everywhere we need:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');
$grandTotal = $cart->getQuote()->getGrandTotal();

Ali Zeinalzadeh
- 312
- 1
- 17