In WooCommerce, does anyone know a way to Remove the Add To Cart button when On Backorder is selected in Inventory, and still keep the On Backorder text on the front end? This would be site wide?
Tried to work this out with:
add_action('woocommerce_single_product_summary', 'check_if_backordered', 1 ); function check_if_backordered(){
global $product;
if ($product->is_on_backorder()){
add_filter( 'woocommerce_is_purchasable', '__return_false');
}
}
But it also removes the Stock Status text.
How to hide add to cart button if product is on backorder but still display the stock status?
To hide add to cart button if product is on backorder but keep stock status display, try:
Code goes in functions.php file of your active child theme (or active theme).
Tested and works with WooCommerce Storefront theme.