How to get most viewed products and bestsellers on homepage in Magento 2

- Fire development, Magento 2

Magento 2 Development

To get most viewed products and bestsellers on homepage in Magento 2, create a block in __construct get instance of

\Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory,

'

for instance

fore recently viewed you can use widget from admin side or else you can write custom block with

see

Source (Stackexchange Question)(Pradeep Kumar)

More tips from the Cookbook

'