Skip to content

Instantly share code, notes, and snippets.

@krillo
Created December 22, 2017 15:31
Show Gist options
  • Save krillo/1b78fbe8a52d4670b69403ae6619da52 to your computer and use it in GitHub Desktop.
Save krillo/1b78fbe8a52d4670b69403ae6619da52 to your computer and use it in GitHub Desktop.
Magento2 get cart subtotal formated
<?php
$helper = $this->helper('\Magento\Checkout\Helper\Cart');
$subtotal = $helper->getQuote()->getSubtotal();
$subtotalHtml = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency($helper->getQuote()->getSubtotal(), true, true);
$grandtotalHtml = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency($helper->getQuote()->getGrandTotal(), true, true);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment