Monthly Archives: September 2015

Woocommerce Change “Read More” Button

This code is useful for removing the “Read More” button (in woocommerce) for items that are out of stock.

/*
 * replace 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()) 
      {
         echo '<a href="'.get_permalink().'" rel="nofollow" class="outstock_button">Sold Out</a>';
      }
      else
      {
         woocommerce_get_template('loop/add-to-cart.php');
      }
   }
 }