In my module, I am getting the current ID and then using the category repository and the "getChildren" method. This works great, except it doesn't return child categories with product counts of 0.

How would I get around this?

"getAllChildren" seemed promising, but returned all descendants, whereas I'm just looking for the immediate children, regardless of product counts.

Edit: For testing purposes, I've added products to these categories that aren't showing up. Their ID's still aren't being returned via the GetChildren method.

  • 1
    Categories are full of strange limitations. I have a different but similar challenge and ended up using getAllChildren and adding a condition later to filter out the crap (for example it returns that parent itself as first element)
    – iphigenie
    Commented Oct 7, 2019 at 8:55

1 Answer 1


Have you tried getChildrenCategories() instead? If in doubt var_dump($catergory->getIsActive()). Although I've generally encountered the other way. I've had to do work to hide empty categories.


  • getChildrenCategories() returns the same categories, unfortunately
    – brackfost
    Commented May 21, 2019 at 13:57

Your Answer

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

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