wc_format_weight()
Format a weight for display.
Хуки из функции
Возвращает
Строку
.
Использование
wc_format_weight( $weight );
- $weight(float) (обязательный)
- Weight.
Список изменений
С версии 3.0.0 | Введена. |
Код wc_format_weight() wc format weight WC 9.3.3
function wc_format_weight( $weight ) { $weight_string = wc_format_localized_decimal( $weight ); if ( ! empty( $weight_string ) ) { $weight_label = I18nUtil::get_weight_unit_label( get_option( 'woocommerce_weight_unit' ) ); $weight_string = sprintf( // translators: 1. A formatted number; 2. A label for a weight unit of measure. E.g. 2.72 kg. _x( '%1$s %2$s', 'formatted weight', 'woocommerce' ), $weight_string, $weight_label ); } else { $weight_string = __( 'N/A', 'woocommerce' ); } return apply_filters( 'woocommerce_format_weight', $weight_string, $weight ); }