Products is not showing up on Magento2 subcategory

22,959

Solution 1

To show the product, check if the product following options:

  1. General->Status = Enabled
  2. general->Visibility = Catalog,Search
  3. Inventory->Qty > 0
  4. Inventory->Stock Availability = In Stock
  5. Websites = checking your site
  6. Catgories = checking your category.

If you want checking product to subcategory, go to Catalog->Manage Categories->Select your category, open tab Display Settings and change option "Is Anchor" to "Yes". Save category.

Solution 2

You can try reindexing.it works if these things all set

1.General->Status = Enabled

2.general->Visibility = Catalog,Search

3.Inventory->Qty > 0

4.Inventory->Stock Availability = In Stock

5.Websites = checking your site

6.Catgories = checking your category.

Solution 3

Sub-category Product show problem solution as you need to follow as below:

Magento 2 Admin==> Products==>Category==> Sub Category==> Design ==>Use Parent Category Settings==>Checked Here

enter image description here

Solution 4

Please run the following command in your commandline:

php bin/magento indexer:status

If one of the indexes is "Processing" then go to your MySQL database and go to the indexer_state table. You will notice that one of the values is "Working" while the rest is "Valid"

Set Working to Invalid and reindex again. The best way to do this is to run the following Query:

update magento.indexer_state set status='invalid' where status ='working'

Good luck!

Solution 5

This is due to reindexing issue.

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" as default setting.
    }
}

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.

Share:
22,959
Zike
Author by

Zike

Updated on December 19, 2020

Comments

  • Zike
    Zike over 3 years

    I installed a fresh magento2, and top categories are working, but for sub-category, there is no product showing up in frontend even thought I assigned products to these sub-categories.

    It's always said "We can't find products matching the selection."

    Where can I find the code in Magento 2 that's responsible for displaying products so I can diagnose this in a programatic manner?