<span class="resolved" aria-label="Resolved" title="Topic is resolved."></span>Hide add to cart

[ad_1]

Replies: 1

When I added the code below found on https://yithemes.com/blog/tutorials/woocommerce-extension-catalog-mode/ to functions.php in my child theme I got this error message: “There has been a critical error on this website. ” Therefore I removed the code again. I use the Divi theme. The code is on one line, does it need to be split over multiple lines to work correctly?

add_action( 'init', 'hide_add_to_cart', 30 ); function hide_add_to_cart() { //Remove from single product page remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); //Remove from Shop/Categories pages add_filter( 'woocommerce_loop_add_to_cart_link', '__return_empty_string', 99 ); }

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer