1

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! – simonthesorcerer Aug 13 '18 at 8:53
0

If you have collection you must add filter like below:

$collection = $this->productCollectionFactory->create();
$collection->setVisibility([1]);

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.