Override recently viewed widget in magento 2
-
20-01-2021 - |
Solution
Copy the below file to your theme:
vendor/magento/module-reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml
Your file location will be like below:
app/design/frontend/[Vendor]/[theme]]/Magento_Reports/templates/widget/viewed/content/viewed_grid.phtml
Below is the php code which you will find top of the above file:
<?php
if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedProducts()->getSize())) {
$type = 'widget-viewed';
$mode = 'grid';
$type = $type . '-' . $mode;
$image = 'recently_viewed_products_grid_content_widget';
$title = __('Recently Viewed');
$items = $block->getRecentlyViewedProducts();
$showWishlist = true;
$showCompare = true;
$showCart = true;
$rating = 'short';
$description = ($mode == 'list') ? true : false;
}
?>
You need to set $showCart = false to hide "Add to cart" button. And you can manage the contents according to your requirement.
Don't forget to flush the cache.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange