-
-
Save Kaiderella/9b9a56f5d5bf171de51604bbdfc939d4 to your computer and use it in GitHub Desktop.
Hide Add to Cart Button for Out of Stock Products
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
function wpcb_remove_out_of_stock_product_button( $html, $product, $args ) { | |
if ( ! $product->is_in_stock() && ! $product->backorders_allowed() ) { | |
return ''; | |
} | |
return $html; | |
} | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'wpcb_remove_out_of_stock_product_button', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment