I need to get all simple products of a category. By using the following code, I'm getting only products which has visibility of Catalog, Search but not Not Visible Individually products.
$categoryId = 12; $categoryFactory = $objectManager->create('Magento\Catalog\Model\CategoryFactory'); $category = $categoryFactory->create() ->load($categoryId) ->getProductCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('type_id', 'simple');
I need all simple products regardless of its visibility. How can I achieve this?