문제

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?

Thanks

도움이 되었습니까?

해결책

$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)
{

    $request->getBaseSubtotalInclTax();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top