wc_format_weight( float $weight )
Format a weight for display.
Description Description
Parameters Parameters
- $weight
-
(Required) Weight.
Return Return
(string)
Source Source
File: includes/wc-formatting-functions.php
function wc_format_weight( $weight ) {
$weight_string = wc_format_localized_decimal( $weight );
if ( ! empty( $weight_string ) ) {
$weight_string .= ' ' . get_option( 'woocommerce_weight_unit' );
} else {
$weight_string = __( 'N/A', 'woocommerce' );
}
return apply_filters( 'woocommerce_format_weight', $weight_string, $weight );
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |