#StackBounty: #magento2 #configurable-product How to display configurable product discount in percent on product list in Magento 2

Bounty: 50

In the product detail page, it’s showing a discount percentage. when I open the list page it can’t be showing the percentage for the configurable product.

Please give me the solution for that.

I have used the below code for that, but it’s not working for the configurable product.

getTypeId() == "simple") { $simplePrice = $_product->getPrice(); } else { $_children = $_product->getTypeInstance()->getUsedProducts($_product); foreach ($_children as $child){ $simplePrice = $child->getPrice(); break; } } $_finalPrice =$_product->getFinalPrice(); $_price = $simplePrice; if($_finalPrice

Get this bounty!!!