Web Analytics

Fill the form & Get Installation Support

How to get recently view product collection in Magento 2?

To do this programmatically, you need the collection function to get called in custom phtml file so that the product will be shown in the file.

Let’s say we have a module which is named “Magemonkeys_Recentlyview”

For that module, we have to create a block file Recentlyview.php at app/code/Magemonkeys/Recentlyview/Block/

Now we can call that block function in custom phtml file

create app/code/Magemonkeys/Recentlyview/view/recentlyview.html file

Now check the result by clearing the cache.


Fill the below form if you have any Magento programming need.

    Recent Articles

    Author Info

    Author Image

    Magento 2 Developer

    Hire P. Garchar

    Get a Free Quote

      /* second popup */

      Connect With Us