I have disabled a category of products that are only for Christmas, but if I use the search engine, the products appear although the category is disabled. How can I do so that the products are also hidden? Do I have to disable the products one by one?

  • disabling a category does not disables associated product. You will have to disable them one by one or you can write a small script to do this or you can simply select those products using mass action in order grid and change the status to disabled – magento noob Jul 5 '19 at 8:44

Make an observer on the catalog_category_save_after event for the adminhtml. In the observer you can retrieve the category object and write your logic there. In general;

  • Create Event
  • Retrieve category that is saved in observer.
  • Retrieve all products from this category and based on the status of the category you can loop through these products to set them enabled/disabled.

If you don't know how to create an event:


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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