I want to display recently viewed products on the product detail page with slider.

1 Answer 1


Please check below guide which will help you.


or you can also do my xml layout to do this

vendor/magento/theme-frontend-luma/Magento_Catalog/layout/catalog_product_view.xml for testing purpose

<referenceContainer name="content">
  <block class="Magento\Reports\Block\Product\Widget\Viewed" after="-" name="recently_viewed" cacheable="false" template="Magento_Reports::widget/viewed/content/viewed_grid.phtml">
    <action method="setPageSize">
       <argument name="page_size" xsi:type="number">4</argument>

You can add above snippet to catalog_product_view.xml file of your custom theme.

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.