Magento – Magento 2 : How to show special price and regular price in cart page

cartcheckoutmagento-2.1magento2onepage-checkout

I want to show base price and special price both in cart page, right now, by default it just shows special price.
How to show exactly like product page or list page.
Version 2.1x

Best Answer

copy file from

../vendor/magento/module-weee/view/frontend/templates/item/price/unit.phtml

to

design/frontend/your_theme_name/Magento_Weee/templates/item/price/unit.phtml

and paste this one :

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var $block \Magento\Weee\Block\Item\Price\Renderer */

$item = $block->getItem();
?>
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
    <span class="price-including-tax" data-label="<?= $block->escapeHtml(__('Incl. Tax')) ?>">
        <?php if ($block->displayPriceWithWeeeDetails()): ?>
            <span class="cart-tax-total"
                data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'>
        <?php else: ?>
            <span class="cart-price">
        <?php endif; ?>
                <?php if($item->getProduct()->getSpecialPrice() != null): ?>
                <label style="color: red;">Old Price :</label>
        <p style="color: red;
    text-decoration: line-through;"><?php echo $block->formatPrice($item->getProduct()->getPrice());?></p>
                <?php endif;?>
            <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceInclTax()) ?>
            </span>

        <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?>
            <span class="cart-tax-info" id="unit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>" style="display: none;">
                <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?>
                    <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>">
                        <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount_incl_tax'], true, true) ?>
                    </span>
                <?php endforeach; ?>
            </span>

            <?php if ($block->displayFinalPrice()): ?>
                <span class="cart-tax-total"
                    data-mage-init='{"taxToggle": {"itemTaxId" : "#unit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'>
                    <span class="weee" data-label="<?= $block->escapeHtml(__('Total Incl. Tax')) ?>">
                        <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceInclTax()) ?>
                    </span>
                </span>
            <?php endif; ?>
        <?php endif; ?>
    </span>
<?php endif; ?>

<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
    <span class="price-excluding-tax" data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>">
        <?php if ($block->displayPriceWithWeeeDetails()): ?>
            <span class="cart-tax-total"
                data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'>
        <?php else: ?>
            <span class="cart-price">
        <?php endif; ?>
                <?= /* @escapeNotVerified */ $block->formatPrice($block->getUnitDisplayPriceExclTax()) ?>
            </span>

        <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($item)): ?>
            <span class="cart-tax-info" id="eunit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"
                style="display: none;">
                <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($item) as $tax): ?>
                    <span class="weee" data-label="<?= /* @escapeNotVerified */ $tax['title'] ?>">
                        <?= /* @escapeNotVerified */ $block->formatPrice($tax['amount'], true, true) ?>
                    </span>
                <?php endforeach; ?>
            </span>

            <?php if ($block->displayFinalPrice()): ?>
                <span class="cart-tax-total"
                      data-mage-init='{"taxToggle": {"itemTaxId" : "#eunit-item-tax-details<?= /* @escapeNotVerified */ $item->getId() ?>"}}'>
                    <span class="weee" data-label="<?= $block->escapeHtml(__('Total')) ?>">
                        <?= /* @escapeNotVerified */ $block->formatPrice($block->getFinalUnitDisplayPriceExclTax()) ?>
                    </span>
                </span>
            <?php endif; ?>
        <?php endif; ?>
    </span>
<?php endif; ?>

use bin/magento cache:clean && bin/magento cache:flush. And all work!!

in my variant path next :

design/frontend/Smartwave/tropenkost/Magento_Weee/templates/item/price/unit.phtml