From To Price Variation is wrong need swap

add_filter( 'woocommerce_format_price_range', 'tzn_woocommerce_format_price_range',999,3 );
function tzn_woocommerce_format_price_range($price,$from,$to) {
// if( current_user_can( 'administrator' ) ){
if($from>$to ){
$term_price = $from;
$from = $to;
$to = $term_price;
}
$price = sprintf( _x( '%1$s – %2$s', 'Price range: from-to', 'woocommerce' ), is_numeric( $from ) ? wc_price( $from ) : $from, is_numeric( $to ) ? wc_price( $to ) : $to );

// }
return $price;
}

Leave a Reply

Your email address will not be published. Required fields are marked *