I am integrating the custom module of custom payment gateway. I need the cart total on the checkout page for the price conversion before the payment.
How can I get the Cart total in JS or in the custom controller? Thanks in advance.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $cart = $objectManager->get('\Magento\Checkout\Model\Cart'); $totalItems = $cart->getQuote()->getItemsCount(); $totalQuantity = $cart->getQuote()->getItemsQty(); $grandTotal = $cart->getQuote()->getGrandTotal();
Hope it works for you..!!