Decimal price
-
Hello,
would you please help me remove decimal price from mywebsite
here after the code used by theme creator:*/
function classifieds_pricing_format( $price ){
$price = number_format( $price, 2 );
$unit_position = classifieds_get_option( ‘unit_position’ );
$unit = classifieds_get_option( ‘unit’ );
$price_el = explode(‘.’, $price);
$main_price = $price_el[0];
$decimal_price = $price_el[1];
if( $unit_position == ‘back’ ){
$price_html = $main_price.'<span>.’.$decimal_price.'</span><span>’.$unit.'</span>’;
}
else{
$price_html = ‘<span>’.$unit.'</span>’.$main_price.'<span>.’.$decimal_price.'</span>’;
}return $price_html;
}/*
PS: I tried to replace 2 by 0 in number format; I got it removed but the decimal separator ( the point separating main price from decimal price) is still there!
The topic ‘Decimal price’ is closed to new replies.