decimals fix

This commit is contained in:
Mike Jolley 2011-12-12 16:51:23 +00:00
parent 1f2f6f7f8e
commit a450ce1214
1 changed files with 1 additions and 1 deletions

View File

@ -148,7 +148,7 @@ function woocommerce_price( $price, $args = array() ) {
$currency_symbol = get_woocommerce_currency_symbol(); $currency_symbol = get_woocommerce_currency_symbol();
$price = number_format( (double) $price, $num_decimals, get_option('woocommerce_price_decimal_sep'), get_option('woocommerce_price_thousand_sep') ); $price = number_format( (double) $price, $num_decimals, get_option('woocommerce_price_decimal_sep'), get_option('woocommerce_price_thousand_sep') );
if (get_option('woocommerce_price_trim_zeros')=='yes') : if (get_option('woocommerce_price_trim_zeros')=='yes' && $num_decimals>0) :
$trimmed_price = rtrim(rtrim($price, '0'), get_option('woocommerce_price_decimal_sep')); $trimmed_price = rtrim(rtrim($price, '0'), get_option('woocommerce_price_decimal_sep'));
$after_decimal = explode(get_option('woocommerce_price_decimal_sep'), $trimmed_price); $after_decimal = explode(get_option('woocommerce_price_decimal_sep'), $trimmed_price);
if (!isset($after_decimal[1]) || (isset($after_decimal[1]) && (strlen($after_decimal[1]) == 0 && strlen($after_decimal[1]) == $num_decimals))) $price = $trimmed_price; if (!isset($after_decimal[1]) || (isset($after_decimal[1]) && (strlen($after_decimal[1]) == 0 && strlen($after_decimal[1]) == $num_decimals))) $price = $trimmed_price;