hide inactive attribute woocommerce
/**
* Disable out of stock variations
* @return Boolean
*/
function njengah_variation_is_active( $active, $variation ) {
if( ! $variation->is_in_stock() ) {
return false;
}
return $active;
}
add_filter( 'woocommerce_variation_is_active', 'njengah_variation_is_active', 10, 2 );