Following this guide Magento 2 : How To Show Price of "out of stock" Products

I successfully managed to show price for out of stock products. But this applies only to simple products. For configurable out of stock products the price printed is always 0,00 while I would like to show the lowest price of simple products composing its parent.

How can I do it?


2 Answers 2


Not sure if this is applicable, but I'm on Magento 2.1.9 and there is an

issue with configurable products showing price of $0.00 when child products are out of stock on Github.

The hack, Albeit a core hack, is the only available remedy it seems.

I added the code & commented below, into


and it fixed my issue.

 * @param \Magento\Framework\Pricing\SaleableInterface|\Magento\Catalog\Model\Product $product
 * @return float|null
public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
    $price = null;

    foreach ($this->lowestPriceOptionsProvider->getProducts($product) as $subProduct) {
        $productPrice = $this->priceResolver->resolvePrice($subProduct);
        $price = $price ? min($price, $productPrice) : $productPrice;

    /* fix >>> */
    $price = $price ?: $product->getData('price');
    /* <<< fix */

    return $price === null ? null : (float)$price;
  • 1
    I have tried this solution and its also working for me as well. Commented Nov 17, 2017 at 5:27

@gianis6 We have the same issue and tracked it back to the LinkedProductSelectBuilderComposite which builds a bunch of SELECT statements. Each of the linkedProductSelectBuilder objects in that class get the StockStatusBaseSelectProcessor class injected into it (module-catalog-inventory/etc/di.xml). That stock status base select processor adds the table and where clause needed to restrict products that are out of stock.

So, my solution is to remove the StockStatusBaseSelectProcessor from the CompositeBaseSelectProcessor when building the select statements.

WARNING: This code may be used by several components in Magento 2. We're still testing to see if it has any adverse effects. If you use this, please run a full UAT to make sure it doesn't break other code.

In the {Vendor}/{Module}/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor" type="{Vendor}\{Module}\Model\ResourceModel\Product\CompositeBaseSelectProcessor" />


In the {Vendor}/{Module}/Model/ResourceModel/Product/CompositeBaseSelectProcessor.php

namespace {Vendor}\{Module}\Model\ResourceModel\Product;

use Magento\CatalogInventory\Model\ResourceModel\Product\StockStatusBaseSelectProcessor;

class CompositeBaseSelectProcessor extends \Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor
    public function __construct(
        array $baseSelectProcessors
    ) {

        $finalProcessors = array();
        foreach ($baseSelectProcessors as $baseSelectProcessor) {
            if(!is_a($baseSelectProcessor, StockStatusBaseSelectProcessor::class)) {
                $finalProcessors[] = $baseSelectProcessor;



Any other ideas on how to selectively remove the StockStatusBaseSelectProcessor only when we need to would be greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.