I am developing a Magento 2 Payment Gateway now I need to get order total to make the payment how to get it on Magento 2 using Magento Cart Models?


2 Answers 2

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart'); 
$grandTotal = $cart->getQuote()->getGrandTotal();

You can get the subtotal using following code :

// Magento\OfflineShipping\Model\Carrier;

public function collectRates(RateRequest $request)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.