How do I apply setVisibility() to 'Not Visible Individually' in Category view's collection?

Basically, I want to load products with visibility 'Not Visible Individually' only for a specific category. The product with visibility 'Not Visible Individually' is assigned to multiple categories, but when viewing those categories this product should be visible only for a specific category and not for the rest of the categories.

So, what I want is to know how to apply this visibility filter in category view's product collection, whether its by plugin, observer or override.

  • Hi, did you solve that? Looking for the same :) TY! Commented Aug 13, 2018 at 8:53

1 Answer 1


If you have collection you must add filter like below:

$collection = $this->productCollectionFactory->create();

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.