Looking for some help with the recently viewed products block/widget in Magento2.3.2. Have tried three different approaches - creating the widget in the widget section, creating the widget as a new block, and using an existing (functioning) product list block (best sellers) as a template - yet each time the block just appears as this on the frontend:

enter image description here

This is the code in editor for reference:

{{widget type="Magento\Catalog\Block\Widget\RecentlyViewed" uiComponent="widget_recently_viewed" page_size="5" show_attributes="name,image,price" show_buttons="add_to_cart" template="product/widget/viewed/grid.phtml"}}

Any help would be greatly appreciated.



1 Answer 1


Just keep below code in your template file for get recently viewed products in any place,

<?php echo $this->getLayout()->createBlock("Magento\Reports\Block\Product\Widget\Viewed")->setDisplayType("recently.view.products")->setProductsCount("5")->setTemplate("widget/viewed/content/viewed_list.phtml")->toHtml(); ?>

reference link.

  • Thanks Ranjeet. Doesn't appeared to have fixed the issue though.
    – fredc
    Mar 9, 2021 at 21:34

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.