Disable add to cart button when product is out of stock

Here are some plugins which provide the facilities to hide “Add To Cart” buttons from the shop and single product page in woocommerce,

[ https://wordpress.org/plugins/hide-add-to-cart-button/) ]

[ https://wordpress.org/plugins/remove-add-to-cart-woocommerce/ ]

These plugins will do,

1) Hide Add to Cart button from product single page.
2) Hide Add to Cart button from category page.
3) Hide Add to Cart button from homepage and all other pages.

Also you can hide it via adding the below function in functions.php,

 /*
 * Override via functions.php
 **/
 if (!function_exists('woocommerce_template_loop_add_to_cart')) {
 function woocommerce_template_loop_add_to_cart() {
    global $product;
    if ( ! $product->is_in_stock() || ! $product->is_purchasable() ) return;
    woocommerce_get_template('loop/add-to-cart.php');
  }
}