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'); | |
} | |
} |
With Woo 3.3 changes to stock management, this gist no longer filters on stock status. Ideas how to fix / update?
Hi @MedMess, Have you found a fix for the above?
How can I change loop button instead of hiding it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool
How might I revise this to display "out of stock" instead of the Read More button?
Thanks