1

I want to display the price range for configurable products on the product page.

  • you can try do it like this link classyllama.com/blog/configurable-product-price-ranges-m2 – alan.D Jan 30 '19 at 11:46
  • I have tried but not working in PDP Working fine on PLP – Magento Developer Jan 30 '19 at 11:54
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Jai Jan 30 '19 at 12:11
  • hi @MagentoDeveloper did u got the solution for this? I have the same requirement can u please provide me the correct answer – Nagaraju K Apr 7 at 10:48
  • @MagentoDeveloper classyllama.com/blog/configurable-product-price-ranges-m2 the is not working did U find the solution for this? – Nagaraju K Apr 7 at 11:08
0

Please follow the below steps.

Step 1: Create a layout file catalog_product_view_type_configurable.xml on this path app/design/frontend/{{companyname}}/{{themename}}/Magento_ConfigurableProduct/layout/catalog_product_view_type_configurable.xml

<referenceBlock name="product.info.price">
    <block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="wk.info.pricerange"  template="Magento_ConfigurableProduct::product/price_range.phtml" />
</referenceBlock>

Step 2: Create template file price_range.phtml on this path app/design/frontend/{{companyname}}/{{themename}}/Magento_ConfigurableProduct/templates/product/price_range.phtml

<?php
$currentProduct = $this->getProduct();
$regularPrice = $currentProduct->getPriceInfo()->getPrice('regular_price');
?>
<div class='price-box'>
    <span class="price">
        <?php
            echo $regularPrice->getMinRegularAmount().'-'.$regularPrice->getMaxRegularAmount();
        ?>
    </span>
</div>
| improve this answer | |
0

I Have Created a Module for Showing Product Min and Max Prices into Price Range Slider View.

You can find the Module from My GIT HUB Repository - https://github.com/vishalthakurit/Magento2-priceRange-Slider/tree/master

Another Solution -

In your module structure create a layout file catalog_product_view_type_configurable.xml, in my case the file path is app/code/{{CompanyName}}/{{ModuleName}}/view/frontend/layout/catalog_product_view_type_configurable.xml.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.price">
            <block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="vishal.info.pricerange"  template="{{CompanyName}}_{{ModuleName}}::product/price_range.phtml" />
        </referenceBlock>
    </body>
</page>

Now, we will create template file price_range.phtml at path app/code/{{CompanyName}}/{{ModuleName}}/view/frontend/templates/price_range.phtml.

<?php
$currentProduct = $this->getProduct();
$regularPrice = $currentProduct->getPriceInfo()->getPrice('regular_price');
?>
<div class='price-box'>
    <span class="price">
        <?php
            echo '<b>Min : </b>'.$regularPrice->getMinRegularAmount().' - <b>Max : </b>'.$regularPrice->getMaxRegularAmount();
        ?>
    </span>
</div>

It will look like the attached Screenshot:-

enter image description here

enter image description here

| improve this answer | |

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.