How to Get Configurable Product Price Range in Magento 2

Hello everybody, couple of days back I got a prerequisite in which I have to show the Price Range of Configurable Product. I figured I should get all the related items and after that get the Minimum Price and Maximum Price. After some exploration in Magento Configurable Product Module I got a major lead. Fortunately Magento gives the strategy to getting the Minimum and Maximum Price. In this Post we will perceive how we can get the Range in layout record.

In your module structure make a format document catalog_product_view_type_configurable.xml, for my situation the record way is application/code/Ikodes/PriceRange/see/base/design/catalog_product_view_type_configurable.xml

<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="">
            <block class="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" name=""  template="Webkul_PriceRange::product/price_range.phtml" />

Now, we will create template file price_range.phtml at
path app/code/Ikodes/PriceRangeCustomisation/view/base/templates/

$currentProduct = $this->getProduct();
$regularPrice = $currentProduct->getPriceInfo()->getPrice('regular_price');
<div class='price-box'>
    <span class="price">
            echo $regularPrice->getMinRegularAmount().'-'.$regularPrice->getMaxRegularAmount();

Likewise, the strategies getMinRegularAmount() and getMaxRegularAmount() restores the cost of In Stock related items as it were. For further investigation the technique definition you can allude to the record


Related Posts

November 21, 2019

Top 10 Business Website Ideas which you can make under 1000+ USD

This Present time is known as the computerized period in light of the fact that in the present occasions each assistance is going on the web, Which implies now individuals can get to any help through an online stage. The fundamental prerequisite of utilizing an online assistance is a cell phone and a web association.

October 12, 2019

History of WordPress

Would you like to think about the historical backdrop of WordPress? On the off chance that you are beginning a WordPress blog or site today, at that point you see a prevalent web designer which fueled over 32% of all sites on the web. In this article, we need to investigate the historical backdrop of