“Add to Cart” button is present on almost every page of a WooCommerce store. However, some store owners wish to either disable or remove this button on some products to make the product unpurchasable.

Remove button on product listing page use following hooks

The code above needs to be included in functions.php which is located in your theme folder.

Remove the Add to Cart Button

Here is how to remove the Add to Cart button from product pages and product listing pages (also known as shop page). I will add the following hooks to woocommerce.php (located wp-content/plugins/woocommerce):

At this point, refresh any product listing or shop page. You will find that the button has been removed from the page.

Remove Add to Cart Button from Specific Product Pages

There are conditions when the store owners wish to list the product on the store but might not wish to make them available for sale. This is made possible by adding a hook: wooCCmmerce_is_purchasable. Now every time this filter detects the product id of the product that is not intended for sale, it will return false. On the frontend, the price would be visible but the Add to Cart button would be replaced by a notice, “Product cannot be purchased”. Remember to add this code to the functions.php (located in the theme folder):

Conclusion

In this short tutorial, I presented the solution of a common problem of WooCommerce store owners. Not everyone wants the “Add to Cart” button on every page of their store. If you need help in implementing this idea on your store, do leave a comment and I will get back to you.