0

I would like to display the price range for configurable products on the product details page. I have followed some references but no luck

app/code/Vendor/ModuleName/view/base/layout/catalog_product_prices.xml

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <referenceBlock name="render.product.prices">
        <arguments>
            <argument name="configurable" xsi:type="array">
                <item name="prices" xsi:type="array">
                    <item name="final_price" xsi:type="array">
                        <item name="render_template" xsi:type="string">Vendor_ModuleName::product/price/final_price.phtml</item>                            
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</layout>

enter image description here

1

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

Layout File will be - app/code/Tecgenome/PriceSlider/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">
    <head>
        <css src="Tecgenome_PriceSlider::css/jquery-ui.css" />
    </head>
    <body>
        <referenceBlock name="product.info.price">
            <block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name="wk.info.pricerange" template="Tecgenome_PriceSlider::product/price_range.phtml" />
        </referenceBlock>
        <move element="wk.info.pricerange" destination="product.info.main" after="page.main.title" />
    </body>
</page>

It will show like this (there may be some CSS issues, you can fix those accordingly)

enter image description here

Hope It will Help you !!!

4
  • thanks, @vishal for sharing can we display the price range as per my reference screenshot. please suggest Apr 8 '20 at 6:32
  • @NagarajuK yes we can do that....just need to changed the catalog_product_view_type_configurable.xml file code as above i have just updated. Apr 8 '20 at 9:00
  • @NagarajuK check the updated Answer. Apr 8 '20 at 9:10
  • @NagarajuK If it worked for you.... can you please mark it GREEN. Apr 12 '20 at 14:21

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.