Last active
November 7, 2019 13:24
-
-
Save mikejolley/1751128 to your computer and use it in GitHub Desktop.
WooCommerce - Hide loop buttons for out of stock items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I change loop button instead of hiding it?