Merge pull request #32746 from YordanSoares/use-price-decimal-separator-for-product-weight-and-dimensions
Use the price decimal separator to format product weight and dimensions
This commit is contained in:
commit
fbd38e5a90
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Use the configured decimal separator to format product weight and dimensions
|
|
@ -181,7 +181,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
||||
|
||||
$locale = localeconv();
|
||||
$decimal = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
||||
$decimal_point = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
||||
$decimal = ( ! empty( wc_get_price_decimal_separator() ) ) ? wc_get_price_decimal_separator() : $decimal_point;
|
||||
|
||||
$params = array(
|
||||
/* translators: %s: decimal */
|
||||
|
|
|
@ -345,14 +345,16 @@ function wc_format_localized_price( $value ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Format a decimal with PHP Locale settings.
|
||||
* Format a decimal with the decimal separator for prices or PHP Locale settings.
|
||||
*
|
||||
* @param string $value Decimal to localize.
|
||||
* @return string
|
||||
*/
|
||||
function wc_format_localized_decimal( $value ) {
|
||||
$locale = localeconv();
|
||||
return apply_filters( 'woocommerce_format_localized_decimal', str_replace( '.', $locale['decimal_point'], strval( $value ) ), $value );
|
||||
$decimal_point = isset( $locale['decimal_point'] ) ? $locale['decimal_point'] : '.';
|
||||
$decimal = ( ! empty( wc_get_price_decimal_separator() ) ) ? wc_get_price_decimal_separator() : $decimal_point;
|
||||
return apply_filters( 'woocommerce_format_localized_decimal', str_replace( '.', $decimal, strval( $value ) ), $value );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue