Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wbcomdev/393cec5955df3c57e8481b174afcda67 to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/393cec5955df3c57e8481b174afcda67 to your computer and use it in GitHub Desktop.
if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
/**
* Hide loop read more buttons for out of stock items.
*/
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' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment