• Create Recently Viewed Products for Model file in Magento 2 ?

1 Answer 1


Create an API with Mage2Gen


Now you can add the logic in


Based on the following function in which a Recently Viewed Product Collection is returned when a Customer Id is available. Don't include the class in your construct because it is a block but copy it and add your own logic.

getItemsCollection in vendor/magento/module-reports/Block/Product/AbstractProduct.php

Then retrieve the current Customer Id through the


  • Can you be more specific with Business Logic ? Dec 10, 2018 at 6:32

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.