Set the simple product Visibility (Catalog->Manage Product->"Select Product"->General) to "Not Visible Individually". Place the simple product to "In Stock" and add Quantity. (Simple products will not show on the front end)
The Configurable product should now show the available simple products. A configurable products inventory is based off the simple product's inventory.
Hope this helps.
You can view out of stock variable in product by remove this code
if ($product->isSaleable() || $skipSaleableCheck) {
from function getAllowProducts()
at class Mage_Catalog_Block_Product_View_Type_Configurable
.
So you need to rewrite
class Mage_Catalog_Block_Product_View_Type_Configurable
Step1: You will need to create /app/code/local/Amit/MyProduct/Block/Catalog/Product/View/Type/
and file Configurable.php
and code:
<?php
class Amit_MyProduct_Block_Catalog_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable{
public function getAllowProducts()
{
if (!$this->hasAllowProducts()) {
$products = array();
$skipSaleableCheck = Mage::helper('catalog/product')->getSkipSaleableCheck();
$allProducts = $this->getProduct()->getTypeInstance(true)
->getUsedProducts(null, $this->getProduct());
foreach ($allProducts as $product) {
$products[] = $product;
}
$this->setAllowProducts($products);
}
return $this->getData('allow_products');
}
}
Step2: create config.xml /app/code/local/Amit/MyProduct/etc/
and code is
<?xml version="1.0"?>
<config>
<modules>
<Amit_MyProduct>
<version>1.0.0</version>
</Amit_MyProduct>
</modules>
<global>
<blocks>
<catalog>
<rewrite>
<product_view_type_configurable>Amit_MyProduct_Block_Catalog_Product_View_Type_Configurable</product_view_type_configurable>
</rewrite>
</catalog>
</blocks>
</global>
</config>
Step3: Create Amit_MyProduct.xml
at app/etc/modules
<?xml version="1.0"?>
<config>
<modules>
<Amit_MyProduct>
<codePool>local</codePool>
<active>active</active>
</Amit_MyProduct>
</modules>
</config>
Best Answer
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.