From a450ce12141ae51ca8913438963b7e9d062939b7 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 12 Dec 2011 16:51:23 +0000 Subject: [PATCH] decimals fix --- woocommerce-core-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/woocommerce-core-functions.php b/woocommerce-core-functions.php index f94fc0b5434..c64271fd713 100644 --- a/woocommerce-core-functions.php +++ b/woocommerce-core-functions.php @@ -148,7 +148,7 @@ function woocommerce_price( $price, $args = array() ) { $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') ); - 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')); $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;