I would like to display Discount Price and Tax Price on minicart, but the code following not work
formatPrice($this->getDiscountAmount())
formatPrice($this->getQuote()->getTaxAmount())
Please help
are these lines not working for you? or what issue you are facing?
$this->getDiscountAmount()
$this->getQuote()->getTaxAmount()
Hi Manish Mittal,
I would like to display discount amount and tax amount on minicart, but it show 0 figure, may I know the correct coding to display the amount. Please advise.
Regards,
Ngoi
Hi Manish Mittal,
Below are the code for Discount and Tax Amount, correct me if wrong:
<div class="subtotal-">
<?php if ($canApplyMsrp): ?>
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
<?php else: ?>
<span class="label"><?php echo $this->__('Cart Discount:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getDiscountAmount()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />
<span class="incl-tax">(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="subtotal-">
<?php if ($canApplyMsrp): ?>
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
<?php else: ?>
<span class="label"><?php echo $this->__('Cart Tax:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getTaxAmount()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />
<span class="incl-tax">(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)</span>
<?php endif; ?>
<?php endif; ?>
</div>
extend Customer Cart class:
namespace <Vender>\Checkout\CustomerData; class Cart extends \Magento\Checkout\CustomerData\Cart public function getSectionData(){ return [ 'tax' => $totals['tax']->getValue(), ]; }
On minicart page:
<div><?= __("Total") ?><span data-bind="text: getCartParam('tax')"></span></div>