cancel
Showing results for 
Search instead for 
Did you mean: 

Original Price not showing on configurable products with special price

Original Price not showing on configurable products with special price

I have asked this before but never found an answer. 

 

If a simple product has a discounted price, it will show the original price crossed out and the discounted price on the category page.

 

However, if it is a configurable product with multiple color options and the options all have the same price and discount. It only shows the discounted price, not the original crossed out.

 

Any ideas how to fix this ?

 

 

Screen Shot 2018-09-18 at 4.43.02 PM.png

6 REPLIES 6

Re: Original Price not showing on configurable products with special price

Hello @mousepad,

 

I copied below file into my theme and removed !$block->isProductList() && on line 22:

vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml

<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>

and both prices now show up.

Both show up also if only one simple product is special-priced so this could be a good solution only when all simples are special-priced, otherwise for those which are not, it shows inconsistent data.

 

--
If my answer is useful, please Accept as Solution & give Kudos

 

Re: Original Price not showing on configurable products with special price

This does not work for me. I have tried to edit the original in the Vendors folder and add it to the theme. Clearing all cache and reloading static content. Doesn’t do anything. I’m on Magento 2.2.5

Re: Original Price not showing on configurable products with special price

Any other solutions ??

This is a serious bug in Magento 

Re: Original Price not showing on configurable products with special price

vendor/magento/module-configurable-product/view/base/templates/product/price

original file - 

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

// @codingStandardsIgnoreFile

?>

<?php
/** @var \Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox$block */

/** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */
$priceModel = $block->getPriceType('regular_price');

/** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */
$finalPriceModel = $block->getPriceType('final_price');

$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
$schema = ($block->getZone() == 'item_view') ? true : false;
?>

<?php if ($finalPriceModel->getAmount()->getValue() !== null): ?>
<span class="normal-price">
<?php
$arguments = [
'display_label' => __('As low as'),
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'finalPrice',
'include_container' => true,
'schema' => $schema
];

/* @noEscape */ echo $block->renderAmount($finalPriceModel->getAmount(), $arguments);
?>
</span>

<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>
<span class="old-price sly-old-price no-display">
<?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [
'display_label' => __('Regular Price'),
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
'price_type' => 'oldPrice',
'include_container' => true,
'skip_adjustments' => true
]); ?>
</span>
<?php endif; ?>
<?php endif; ?>

<?php if ($block->showMinimalPrice()): ?>
<?php if ($block->getUseLinkForAsLowAs()):?>
<a href="<?php /* @escapeNotVerified */ echo $block->getSaleableItem()->getProductUrl(); ?>" class="minimal-price-link">
<?php /* @escapeNotVerified */ echo $block->renderAmountMinimal(); ?>
</a>
<?php else:?>
<span class="minimal-price-link">
<?php /* @escapeNotVerified */ echo $block->renderAmountMinimal(); ?>
</span>
<?php endif?>
<?php endif; ?>

 

 

try this code

 

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

// @codingStandardsIgnoreFile

?>

<?php
/** @var \Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox$block */

/** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */
$priceModel = $block->getPriceType('regular_price');

/** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */
$finalPriceModel = $block->getPriceType('final_price');

$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
$schema = ($block->getZone() == 'item_view') ? true : false;
?>

<?php if ($finalPriceModel->getAmount()->getValue() !== null): ?>
<span class="normal-price">
<?php
$arguments = [
'display_label' => __('As low as'),
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'finalPrice',
'include_container' => true,
'schema' => $schema
];

/* @noEscape */ echo $block->renderAmount($finalPriceModel->getAmount(), $arguments);
?>
</span>

<?php if ($block->hasSpecialPrice()): ?>
<span class="old-price">
<?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [
'display_label' => __('Regular Price'),
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
'price_type' => 'oldPrice',
'include_container' => true,
'skip_adjustments' => true
]); ?>
</span>
<?php endif; ?>
<?php endif; ?>

<?php if ($block->showMinimalPrice()): ?>
<?php if ($block->getUseLinkForAsLowAs()):?>
<a href="<?php /* @escapeNotVerified */ echo $block->getSaleableItem()->getProductUrl(); ?>" class="minimal-price-link">
<?php /* @escapeNotVerified */ echo $block->renderAmountMinimal(); ?>
</a>
<?php else:?>
<span class="minimal-price-link">
<?php /* @escapeNotVerified */ echo $block->renderAmountMinimal(); ?>
</span>
<?php endif?>
<?php endif; ?>

Re: Original Price not showing on configurable products with special price

Great! This worked for me. After spending hours searching....

Re: Original Price not showing on configurable products with special price

 

This actually worked for me.
Copy final_price.phtml from:
/app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml
to:
in this i did created /price/ folder and copy the filefinal_price.phtml there (since it didn't existed in my themplate)
/app/design/frontend/Magento/luma/Magento_ConfigurableProduct/templates/product/price/final_price.phtml

FINAL CODE for: final_price.phtml

<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** @var \Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox$block */ /** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */ $priceModel = $block->getPriceType('regular_price'); /** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */ $finalPriceModel = $block->getPriceType('final_price'); $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : ''; $schema = ($block->getZone() == 'item_view') ? true : false; ?> <span class="normal-price"> <?= /* @noEscape */ $block->renderAmount($finalPriceModel->getAmount(), [ 'price_id' => $block->getPriceId('product-price-' . $idSuffix), 'price_type' => 'finalPrice', 'include_container' => true, 'schema' => $schema, ]); ?> </span> <?php if ($block->hasSpecialPrice()): ?> <span class="old-price sly-old-price"> <?= /* @noEscape */ $block->renderAmount($priceModel->getAmount(), [ 'price_id' => $block->getPriceId('old-price-' . $idSuffix), 'price_type' => 'oldPrice', 'include_container' => true, 'skip_adjustments' => true ]); ?> </span> <?php endif; ?> <?php if ($block->showMinimalPrice()) : ?> <?php if ($block->getUseLinkForAsLowAs()) :?> <a href="<?= $block->escapeUrl($block->getSaleableItem()->getProductUrl()) ?>" class="minimal-price-link"> <?= /* @noEscape */ $block->renderAmountMinimal() ?> </a> <?php else :?> <span class="minimal-price-link"> <?= /* @noEscape */ $block->renderAmountMinimal() ?> </span> <?php endif?> <?php endif; ?>