Magento – Magento 2 Products Not Showing in Category (but are visible via search)

categorymagento-2.1magento-2.1.3products

Got a little issue here with Categories.

Running Magento 2.1.3

All other categories display the correct amount of product, except this one click here to view1]

Under Products->Categories->"Kingdom Death" category shows 66 products.

However, when you go to a front-end it would only display 16 products.

Things I've done so far:

  • Cleared Cached
  • Re-indexed everything
  • Remove/Re-added products to the same category
  • Made sure the products are enabled
  • Made sure the items are in stock
  • Made sure the product visibility is set to "Catalog, Search"

I've compared those 16 products that are visible to the "invisible" ones and there is no visible changes all the parameters and attributes are identical.

Also, if I search for the "invisible" product on the site, it will display it and find it, but doesn't work if i try to find it using a category .

Greatly appreciate the help!

Best Answer

This is my correct answer. I just experienced your issue on my site. My site is based on Magento 2.1.5. You should add some xml and php file on your app folder.

Especially, site is just live production one, my answer is just more convenient answer.

We can easily add these two files on original Modules folder.

app\code\Modules\Catalog\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\Indexer\Category\Product\Action\Full" type="Modules\Catalog\Model\Indexer\Category\Product\Action\Full" />
</config>

app\code\Modules\Catalog\Model\Indexer\Category\Product\Action\Full.php

<?php 
namespace Modules\Catalog\Model\Indexer\Category\Product\Action;

/**
 * Class AbstractAction
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/

class Full extends \Magento\Catalog\Model\Indexer\Category\Product\Action\Full {

    public function isRangingNeeded() {
        return false; //It was "true" on default vendor part. 
    }
}

Then, we should run this command.

php bin/magento cache:clean
php bin/magento indexer:reindex

Finally, we got whole 2000 products on our category page instead of previous 340 products on frontend page. Also, the "Product category" tab on index management is just updated from date of version upgraded to current indexing date and time.

Great experience!

Hope this will help many developers and owners.