Woocommerce Sort by default variation price

get_variation_default_attributes and woocommerce_price are depreciated.

This works for me. If I have set default attributes.

function custom_variation_price( $price, $product ) {
    foreach($product->get_available_variations() as $pav){
        $def=true;
        foreach($product->get_default_attributes() as $defkey=>$defval){
            if($pav['attributes']['attribute_'.$defkey]!=$defval){
                $def=false;             
            }   
        }
        if($def){
            $price = $pav['display_price'];         
        }
    }   
    return wc_price($price);
}