WordPress Managed Hosting - 40% Off For 4 Months - Coupon Code: BFCM2021 Avail Now

How To Hide or Disable Add To Cart Button In WooCommerce Store

Moeez — September 21, 2017 2 Minutes Read
woocommerce add to cart button

“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.

Create Faster WordPress Websites!

Free eBook on WordPress Performance right in your inbox.


    Create Faster WordPress Websites!

    Free eBook on WordPress Performance right in your inbox.

      Moeez is ‘The’ blogger in charge of WPblog. He loves to interact and learn about WordPress with people in the WordPress community. Outside his work life, Moeez spends time hanging out with his friends, playing Xbox and watching football on the weekends. You can get in touch with him at moeez[at]wpblog.com.

      THERE'S MORE TO READ

      Newsletter

        WordPress Help Zone - Ultimate WordPress Pit-Stop

        Learning WordPress? Or are you expert enough to help others? Join our WP Facebook group!