Skip to content

Instantly share code, notes, and snippets.

@DustinHartzler
Created November 13, 2015 18:07
Show Gist options
  • Save DustinHartzler/d83b504a17adbc535ebb to your computer and use it in GitHub Desktop.
Save DustinHartzler/d83b504a17adbc535ebb to your computer and use it in GitHub Desktop.
/*
* 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">Out of Stock</a>';
}
else
{
woocommerce_get_template('loop/add-to-cart.php');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment