Remove Add to Cart Function in Magento related products list

更新日期: 2024-12-23 阅读次数: 25 字数: 90 分类: magento

Removed Add to Cart function in magento 2 product detail page, but this function still exists at the bottom of page, in related products list section.

Change phtml code to hide it!

Search File

> cd vendor/magento
> grep "related_products" -r .

./module-catalog/view/frontend/templates/product/list/items.phtml:            
$image = 'related_products_list';

./module-catalog/view/frontend/templates/product/list/items.phtml: 
$image = 'related_products_list';

./module-catalog/view/frontend/templates/product/list/items.phtml:  
name="related_products[]"

Change Code

vim ./module-catalog/view/frontend/templates/product/list/items.phtml

commend Add to Cart codes in this phtml file using:

<!--
-->

Flush cache to make changes take effect

> php bin/magento cache:flush

微信关注我哦 👍

大象工具微信公众号

我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式