6

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

2
  • 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? Mar 4, 2019 at 13:07
  • sorry I use swatch only for size and discount in my case are the same whatever the size (like in Magento1).
    – cap340
    Mar 6, 2019 at 23:04

1 Answer 1

17

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)

4
  • 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, 2018 at 1:57
  • 1
    I also removed 'sly-old-price' class to fix display:none inline css that was hiding ol price. Aug 27, 2018 at 10:18
  • @RehanMobin Your comment has to be a part of the solution by default! Jul 17, 2020 at 8:43
  • 1
    @araujophillips I can edit the post if you want but in my case it works without removing this class. Probably something in the theme I bought... I will try with luma in a blank M2 and sample data to see
    – cap340
    Jul 17, 2020 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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