In some cases, we can add them to functions.php file but in some cases it may generate some error. So, I’m going to place these hooks in woocommerce.php file under the plugins folder.

To access this file go to wordpress > wp-content > plugins > woocommerce and open the file woocommerce.php there and after line 904 place these two hooks.

Save the file then refresh page. Add to cart buttons should have been removed from the site.

Thats it.

How to remove the Add to Cart button from a specific product Only?

There are a couple of ways to do that, depending on the desired result:

1- You could simply empty the price fields. The product will no longer have a price, nor an Add to cart button.
2- You could enable stock management, and set the product stock to zero.
3- You could write a filter for the “woocommerce_is_purchasable” hook, and return false when the product ID is the target one. This would leave the price visible, and display a “product cannot be purchased” note instead of the Add to cart button.

We will achieve the result by going with the Third option that is to add code to the functions.php file of the Child theme.