Search code examples
phpelasticsearchmagento2magento2.4

Magento 2 Products Missing from Category Pages after Magento 2.4.5 Update


After updating to Magento 2.4.5 product category pages no longer show products. However, the filters on the left side of the page indicate that products should be visible for instance:

Magento 2 products missing

I've tried the following to fix the issue to no avail:

  • Disabled all custom plugins
  • Reverted to the default Luna theme
  • Reindex
  • Clear cache
  • Restarted Elasticsearch

Solution

  • After a long search I was able to find this issue and work-around for this problem. It seems to be an issue around the catalog option to display all products.

    Workaround option #1:

    Override limiter.phtml in your theme:

    app/design/frontend/Your/Theme/Magento_Catalog/templates/product/list/toolbar/limiter.phtml

    <?php
    /**
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    ?>
    <?php
    /**
     * Product list toolbar
     *
     * @var \Magento\Catalog\Block\Product\ProductList\Toolbar $block
     * @var \Magento\Framework\Locale\LocaleFormatter $localeFormatter
     */
    ?>
    <div class="field limiter">
        <label class="label" for="limiter">
            <span><?= $block->escapeHtml(__('Show')) ?></span>
        </label>
        <div class="control">
            <select id="limiter" data-role="limiter" class="limiter-options">
                <?php foreach ($block->getAvailableLimit() as $_key => $_limit):?>
                    <option value="<?= $block->escapeHtmlAttr($_key) ?>"
                        <?php if ($block->isLimitCurrent($_key)):?>
                            selected="selected"
                        <?php endif ?>>
                        <?= $block->escapeHtml($_limit) ?>
                    </option>
                <?php endforeach; ?>
            </select>
        </div>
        <span class="limiter-text"><?= $block->escapeHtml(__('per page')) ?></span>
    </div>
    

    After doing so be sure to run: php bin/magento setup:di:compile

    Workaround option #2:

    Turn off Allow All Products per Page by going to Stores > Settings > Configuration > Catalog > Catalog

    Set Allow All Products per Page to No

    enter image description here

    After doing so be sure to run:

    php bin/magento setup:di:compile
    php bin/magento cache:flush
    

    https://github.com/magento/magento2/issues/35900#issuecomment-1210181110