Remove Add to Cart Function in Magento related products list

文章目录

    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 聊聊,或者关注我的个人公众号“大象工具”, 查看更多联系方式