Magento2 Out of Stock Assosiated Products not showing in the dropdown options for Configurable Products

Magento2 Out of Stock Assosiated Products not showing in the dropdown options for Configurable Products

July 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento2 Out of Stock Assosiated Products not showing in the dropdown options for Configurable Products

Magento2: Displaying Out of Stock Associated Products in Configurable Product Dropdown

Introduction

As an experienced developer and frequent user of the Magento platform, I often receive queries about displaying out-of-stock associated products within the dropdown options for configurable products. This issue is a common pain point for many merchants looking to provide comprehensive product information while managing inventory effectively.

In this post, we’ll dive into the specifics of your problem, explore potential causes, and guide you through a step-by-step solution to ensure that out-of-stock associated products appear in the configurable product dropdown with clear stock status indicators.

Understanding the Issue

The issue at hand revolves around Magento2’s default behavior when displaying associated products for configurable items. By default, if an associated product is out of stock, it will not be visible in the configuration options. This is designed to maintain a seamless user experience by hiding unavailable variants.

However, there are scenarios where merchants may want to inform customers about all available variants, including those that are currently out of stock. Providing this visibility can enhance transparency and help manage customer expectations regarding product availability.

Potential Causes and Debugging Steps

Before we proceed with the solution, let’s examine some common reasons why your current setup might not be showing out-of-stock associated products:

  1. Configuration Setting Verification: Ensure that you have correctly configured the “Display Out of Stock Products” setting in Stores -> Configuration -> Catalog -> Inventory.

  2. Module Compatibility: If you have installed any third-party extensions or customizations, they may be conflicting with the stock status display logic.

  3. Product Attributes: Verify that your associated products have accurate and consistent stock quantities set at both the product level and the stock item level.

  4. Template Overrides: Check if any template files (e.g., catalog_product_view_type_configurable.phtml) have been modified by a theme or extension, which could be overriding the default behavior.

To help you diagnose further:

  1. Enable Magento2’s developer mode for enhanced error reporting and debugging information.
  2. Access the System -> Configuration menu with a user that has sufficient permissions to view all settings.
  3. Navigate to Catalog -> Inventory and double-check the “Display Out of Stock Products” setting is enabled.

The Solution: Extending Magento Core Functionality

To achieve your desired outcome, we’ll need to modify Magento’s core functionality by extending its existing logic for displaying associated products in a configurable product view.

Here are the key steps involved:

  1. Identify and Modify Relevant Files: Locate the catalog_product_view_type_configurable.phtml template file within your theme or Magento root folder. This file is responsible for rendering the dropdown options for configurable products on the frontend.

  2. Extend the Default Logic: Within this template, you’ll need to override the default conditions that exclude out-of-stock associated products from the display. To do this, modify the if-else statements around line 104 (or its corresponding location) to include a check for stock availability:

<?php foreach ($block->getAllowProducts() as $_associatedProduct): ?>

    <option value="<?php echo $_associatedProduct->getId(); ?>" data-label="<?php echo $this->escapeHtml($_associatedProduct->getName()); ?>">
        <?php if ($_associatedProduct->isAvailable() || $_associatedProduct->getIsSaleable()): ?>
            <?php echo $this->escapeHtml($_associatedProduct->getName()); ?>
        <?php else: ?>
            <?php echo $this->escapeHtml(__('Out of Stock')); ?> - <?php echo $this->escapeHtml($_associatedProduct->getName()); ?>
        <?php endif; ?>
    </option>

<?php endforeach; ?>

In this modified code snippet, we’re adding an additional condition to display the associated product even if it’s out of stock. If the product is not available or not saleable (i.e., out of stock), the template will now prefix its name with “Out of Stock.”

  1. Commit and Test: Save your changes, clear Magento2’s cache, and reload the configurable product page on your frontend. You should now see all associated products listed in the dropdown options, with out-of-stock items clearly marked.

Conclusion

Displaying out-of-stock associated products within the configurable product dropdown requires a careful modification of Magento2’s core template files to extend its built-in functionality. By following the steps outlined above and carefully verifying your configuration settings, you can ensure that customers have access to comprehensive information about all available variants, including those that are currently unavailable.

Remember to always backup your files before making modifications and thoroughly test the changes in a staging environment before deploying them to your production site. Additionally, consider reaching out to Magento’s official support channels or consulting with experienced Magento developers for more complex customizations.

For further guidance on optimizing your eCommerce platform and leveraging the full potential of Magento2, visit Laravel Company for expert consultation and comprehensive development services tailored to your business needs.

Magento 2 Catalog Themes Configuration

Our network