I have create the custom module and get the subtotal value Please check code hope help you,
Mage/Subtotal/Block/Checkout/Quoteinfo.php
<?php namespace Mage\Subtotal\Block\Checkout; class Quoteinfo extends \Magento\Framework\View\Element\Template { public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Checkout\Model\Session $checkoutSession, array $data = [] ) { parent::__construct($context, $data); $this->_checkoutSession = $checkoutSession; } public function getQuoteData() { $this->_checkoutSession->getQuote(); if (!$this->hasData('quote')) { $this->setData('quote', $this->_checkoutSession->getQuote()); } return $this->_getData('quote'); } }
Mage/Subtotal/etc/module.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Mage_Subtotal" setup_version="2.0.0"/> </config>
Mage/Subtotal/view/frontend/layout/checkout_index_index.xml
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> <block class="Mage\Subtotal\Block\Checkout\Quoteinfo" before="" cacheable="false" template="Mage_Subtotal::checkout/quoteinfo.phtml"> </block> </referenceContainer> </body> </page>
Set Your right position.
Mage/Subtotal/view/frontend/templates/checkout/quoteinfo.phtml
<?php $quote = $block->getQuoteData(); //Get subtotal and grand total of customer current cart ?> <div class="subtotal"> <?php echo __('Cart Subtotal'); ?> <?php echo $subTotal = $quote->getSubtotal(); ?> </div>
Mage/Subtotal/registration.php
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Mage_Subtotal', __DIR__ );
Cart subtotal value move your right position
I hope help you
Thanks.