I have the following code to get my product collection:

$collection = $this->_productCollectionFactory->create();
$collection->setOrder('id', 'ASC');
$collection->addAttributeToFilter('status', ['in' => $this->_productStatus->getVisibleStatusIds()]);
$collection->addAttributeToFilter('type_id', array('neq' => 'bundle'));
$collection->addAttributeToFilter('type_id', array('neq' => 'configurable'));
$collection->addAttributeToFilter('type_id', array('neq' => 'grouped'));

I need included in this collection all child products that are set to "Not visible individually" where the parents are enabled and set to visible. Currently when the product is set to not visible it does not show up.

  • you want visible and not visible both products? Dec 4, 2017 at 17:00
  • Yes. But only those not visible where the parent product is visible and enabled.
    – alobeejay
    Dec 4, 2017 at 17:07

1 Answer 1


Change your setVisibility() function with below code.


It should work

  • This returns a completely empty collection.
    – alobeejay
    Dec 5, 2017 at 7:27

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.