Consider my 'shorts' category below. It has 149 products in. 13 are configurable, the rest are simple products that have a visibility of 'Not visible individually'.
I have the following:
$category = $this->categoryRepositoryFactory->create(); $category = $category->get(20); $collection = $this->productCollectionFactory->create(); $collection->addAttributeToSelect('*'); $collection->addAttributeToFilter('visibility', [1,2,3,4]); $collection->addCategoryFilter($category); $collection->setOrder('cat_index_position','DESC');
This only retrieves the 13 records with the Configurable products with visibility of 'Catalog, Search'.
(It also doesn't order by position, but that's another matter)
I want to get a list of ALL of the products in the category - Not visible included.
I have tried reindexing, cache etc, but no luck.