0

How to hide all disabled products category, what is the best practice to achieve in Magento 2.3.4?

3
  • when you want to hide categories? Sep 24, 2020 at 9:03
  • @RakeshDonga We disabled random items, some of the categories have 0 products, but the category still visible and shown no products, how to hide the category if 0 products in it?
    – zus
    Sep 24, 2020 at 9:13
  • I hope my point clear, how to achieve this shall i use observer or plugins?
    – zus
    Sep 25, 2020 at 9:58

1 Answer 1

0

Where do you want to hide your category ?

If it's in the filter then it's the native magento behaviour to hide them when they have no products.

If it's not there, then you probably just need to override the template calling the category like in your menu, and use a count condition on the category items.

An other work around would bo to override the controller that call the category and if a category is called with no items you can do whatever you want. (Because even if you can't see the category it doesn't mean that your Jean Kevin user can't enter his path in the adress bar.

2
  • We disabled random items, some of the categories have 0 products, but the category still visible and shown no products, how to hide the category if 0 products in it?
    – zus
    Sep 24, 2020 at 9:53
  • how did you solve this problem Nov 23, 2020 at 13:28

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.