I am using the Magento 2.1.8 version.

Facing an issue of products count next to the category name.

enter image description here

The categories of Anchor is enabled.

I did reindex and flush the Magento cache.

In addition, some products are shown in the frontend, which are not assigned for that category.

Can anyone advise on this?

  • 1
    check after disable anchor. because if anchor is enable then it will add sub category products count to parent. Feb 9, 2019 at 7:36
  • okay, I'll try it
    – user73267
    Feb 9, 2019 at 7:40
  • tried, but still the issue persists.
    – user73267
    Feb 9, 2019 at 7:45
  • @Shesh Please check magento.stackexchange.com/a/261081/62611 hope will help you. Feb 9, 2019 at 11:21
  • 1
    @SatishDubariya thanks :) disabled is_Anchor but after reindex and flush the cache the problem seems to resolve.
    – user73267
    Feb 9, 2019 at 12:33

3 Answers 3


Don't be confused. Product count display is different then the actual product count in a category because Anchor is enabled.

The Anchor display setting for categories allows a category to inherit and display all products from its child categories. When Anchor Enable, products assigned to child categories will be combined and displayed in the parent category along with any products directly assigned to it. This means you can use Anchor at upper-level categories to avoid having to explicitly assign products all the way along a branch of the category tree. Instead, simply assign products to their lowest level (most specific) category and they will then be displayed automatically in parent categories.

I hope this will make sense.


There may be many reasons for it. Few which I can list

  • Product is out of stock
  • Product status is Disabled
  • Product visibility does not include Catalog
  • Product is not assigned to that particular website

Another possibility may be "Magento 1.9 has this issue but I am not sure about Magento 2"

In normal case, when you assign products to category then those products will be linked with that category and linked product count will be increased for that category. And if you unlink that product from that category then linked product count will be decreased.

Now problem will be arise when you delete product from catalog->product section. Still category will have entry for that product. So old product count will be in category.

Please check above scenario as well

I hope this will help

  • I checked.. everything is fine as per suggestion. I am confused where is the fault.
    – user73267
    Feb 9, 2019 at 9:18
  • @shesh I added one more scenario in answer please check it Feb 9, 2019 at 10:10
  • Thanks a lot Muhammad bhai.. It's also helpful for me and others :)
    – user73267
    Feb 9, 2019 at 12:35
  • Hello @MuhammadHasham How can I fix the count if I have removed products? May 30, 2019 at 7:04

If you put Anchor in Display Settings to yes this category shows all of the products of its own and all of its subcategories in the frontend.

Therefore the 13 products you see are a subset of what you see in frontend (if all of this 13 products have the right visibility and are saleable of course).

The 17 in the category tree is the sum of all unique products of the category itself and the products of subcategories (given the fact that Anchor is enabled). So if you have some products in the category itself and in one of the subcategories this product is counted only once.

You can check if everything is ok in your system with that category by running this SQL statement:

select count(distinct product_id) from catalog_category_product where 
category_id in (
   select entity_id from catalog_category_entity where parent_id = [YOUR 

If the result is 17 everything is fine.

I hope that helps.

  • Your welcome, since I posted my answer before the one you accepted, I hope that gave you some added value :-)
    – HelgeB
    Feb 9, 2019 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.