A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Hide ‘read more’ buttons for out of stock items

Products that are out of stock still invite customers to read more. It is not clear the product is unavailable until the visitor have viewed the individual product page. This code hides the “read more” button when a product is out of stock.

		/**
 * Hide 'read more' buttons for out of stock items 
 */

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;
    wc_get_template('loop/add-to-cart.php');

  }
}
	
View Raw Code ID: 91013