3

In my old 1.7.0.2 version, I have in a category product list :

"special_price" instead of "regular_price" like : 200$ instead of 350$

As I understand Magento2 change the way of setting special_price for a configurable product, but also the way of this special_price is display (seems to display the lowest price for simple products associated)

How Can I display the old price AND the special_price in Magento2 ?

PS : I use only configurable products

  • There is however another issue with this solution - if you change swatch on configurable product to a swatch that has no discount applied (therefore old price hides), old price hides on all other configurable products on listing as well. This is because configurable-product/../configurable.js the only selector is the "sly-old-price" but with no scope of which product container swatch is changed. Any ideas how to modify this? – Michal Bobocký Mar 4 at 13:07
  • sorry I use swatch only for size and discount in my case are the same whatever the size (like in Magento1). – urbansurfers Mar 6 at 23:04
7

Found solution here : https://github.com/magento/magento2/issues/7624

Copy final_price.phtml from

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

to

Vendor/theme/Magento_ConfigurableProduct/templates/product/price/final_price.phtml

change (around line 22)

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

(special_price will display)

and replace
<span class="old-price sly-old-price no-display">
by
<span class="old-price sly-old-price">

(remove the no-display class)

  • Thanks for the suggestion. However, after update the final_price.phtml, there's still an inline css gengerated as "display:none". Not sure why is that happening, I had to use css rewrite to get it work. – Ethan Wan Jun 18 '18 at 1:57
  • I also removed 'sly-old-price' class to fix display:none inline css that was hiding ol price. – Rehan Mobin Aug 27 '18 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.