Skip to main content

Magento 2 Get Cart Quote Total in minicart.phtml

 

This Below line is workig for all cases if cache is enable its working fine,

<span data-bind="html: getCartParam('subtotal')"></span> 
 
Add this in  minicart.phtml
<?php
    $quote = $block->getTotalsCache();
    $getSubTotal = $quote['subtotal']->getData('value');
    $getGrandTotal = $quote['grand_total']->getData('value');
    $getShippingRate = $quote['shipping']->getData('value');

        $finalSubTotal = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format($getSubTotal,2),true,false);
        $finalShippingTotal = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format($getShippingRate,2),true,false);
        $finalGrandTotal = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format($getGrandTotal,2),true,false);
?>
 

Comments

Popular posts from this blog

Magento 2: Category list for custom magento system configuration section ( Backend )

In system.xml file field for multi select of category is like: NOTE: Use Select for Single item and multiselect for multiple in - <field id = "bannerlist" translate = "label" type = " multiselect " <group id = "bannerblock_setting" translate = "label" type = "text" delault = "1" sortOrder = "3" showInDefault = "1" showInWebsite = "1" showInStore = "1" > <label> Setting </label> <field id = "bannerlist" translate = "label" type = "multiselect" sortOrder = "10" showInDefault = "1" showInWebsite = "1" showInStore = "1" > <label> Select Category </label> <!-- <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>--> <source_model> Ipragmatech\Bannerblock\Model\Config\Source\C...