I have this function for WooCommerce that makes products grayed out and non-selectable if is not currently in stock.

add_filter( 'woocommerce_variation_is_active', 
'grey_out_variations_when_out_of_stock', 10, 2 );

function grey_out_variations_when_out_of_stock( $grey_out, $variation ) {

if ( ! $variation->is_in_stock() )
    return false;

return true;

but this function only when product is variable without backorder product available. When Backorder Product is enabled, this function dont works. How to make this function to function also for backorder products?

Read more here: How to make product greyout when backorder product is not in stock?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: