cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2. Show both regular & special price on configurable products

SOLVED

Magento 2.2. Show both regular & special price on configurable products

The question is about the prices of the products. In the simple there is no problem, it shows the normal price and the special price. On the other hand, in the configurables for example in this product https://www.vendetucasaenchina.com/tankini-premama-a-rayas-estilo-nautico.html, the price of all the configurable and the simple products is 46.95 € and the special 39.95 €. Both on the category page and in the product page, it puts the special price at € 39.95, but if you select a size, it sets the Normal Price on the side and the Special on the side as it should be. Can not I set prices for all configurable products in this way? The normal price and the special one.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 2.2. Show both regular & special price on configurable products

In the page of the category and product page I have already achieved it in the following way.
In vendor / magento / module-configurable-product / view / base / templates / product / price I have added the following<?php if ($block->hasSpecialPrice()): ?>
<span class="old-price">
<?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [
'display_label' => __('Regular Price'),
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'oldPrice',
'include_container' => true,
'skip_adjustments' => true
]); ?>
</span>
<?php endif; ?>

 

View solution in original post

11 REPLIES 11

Re: Magento 2.2. Show both regular & special price on configurable products

Hi @juanrdosil

 

By default in Magento 2 , its not possible - but yes you need to do some customization to achieve your requirement :

 

You need to copy below file into your 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 show up.

 

You can also refer below links for more details : 

 

https://community.magento.com/t5/Magento-2-x-Admin-Configuration/Configurable-Price-Special-price/m-...

 

https://magento.stackexchange.com/questions/177518/show-both-regular-special-price-on-configurable-p...

 

It will works

 

Hope it helps !

 

if issue solved,Click Kudos & Accept as Solution

Re: Magento 2.2. Show both regular & special price on configurable products

As the template I use does not have any directory in / vendor / ... I have copied final_price.phtml to / app / design / frontend / Mgs / claue / Magento_Configurable_Product / templates / product / price but but the original price in the configurable product still does not show

Re: Magento 2.2. Show both regular & special price on configurable products

Hi @juanrdosil

 

I understand - the problem you are facing !

 

From this location :-  vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml

 

you need to copy that file and paste it into below location : 

 

app/design/frontend/Mgs/claue/Magento_Configurable_Product/templates/product/price/final_price.phtml

 

then in that file - you need to change condition which i have posted above !

 

Make sure your active theme is MSG

 

if MSG is not active then whatever theme is active you need to paste this file and change condition into that MSG theme template only !

 

Hope it helps

if issue solved,Click Kudos & Accept as Solution

Re: Magento 2.2. Show both regular & special price on configurable products

Hi @Manthan Dave

Yes, I have the MGS template activated and running. I created these directories because there were no Magento_Configurable_Product / templates / product / price and copied final_price.html with the indicated changes but it still does not show the old price correctly, it only shows it when selecting the simple product, for example in this product when selecting size https : //www.vendetucasaenchina.com/tankini-premama-a-rayas-estilo-nautico.html

Re: Magento 2.2. Show both regular & special price on configurable products

In the page of the category and product page I have already achieved it in the following way.
In vendor / magento / module-configurable-product / view / base / templates / product / price I have added the following<?php if ($block->hasSpecialPrice()): ?>
<span class="old-price">
<?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [
'display_label' => __('Regular Price'),
'price_id' => $block->getPriceId('product-price-' . $idSuffix),
'price_type' => 'oldPrice',
'include_container' => true,
'skip_adjustments' => true
]); ?>
</span>
<?php endif; ?>

 

Re: Magento 2.2. Show both regular & special price on configurable products

I have the same issue and i am using mgs theme and more specific the unero theme. 

 

Could you please post the file structure ? Also did you kept the original structure and just added this ? 

Re: Magento 2.2. Show both regular & special price on configurable products

The final_price.html suggestion does not work.

Followed exactly but no luck. Anyone else got any ideas ?

Re: Magento 2.2. Show both regular & special price on configurable products

In 2.2.3 this causes the original price to flash for a second then it ends up being replaced and shows the special price where the original price should be. So you have two prices displayed exactly the same.

Re: Magento 2.2. Show both regular & special price on configurable products

<?php if ($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; ?>

 

Remove no-display class then it will display both prices in Frontend.

 

Hope it helps