I have used below code in,
<?php $_productCollection = $block->getLoadedProductCollection(); $_helper = $this->helper('Magento\Catalog\Helper\Output'); $_productCollection->clear() ->addAttributeToFilter('best_seller',1) ->load(); ?>
I am filtering category loaded products here, with the attribute "best_seller".
The code is working and products are filtered and showing in list page, but the count in layer navigation is not correct.
Am i used correct code? Is there any other way to override list page products.
Please anyone suggest me how this can be done? Thank you