0

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?

Ali Zeinalzadeh
  • 312
  • 1
  • 17

1 Answers1

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