wc_bool_to_string()WC 3.0.0

Converts a bool to a 'yes' or 'no'.

No Hooks.

Return

String.

Usage

wc_bool_to_string( $bool );
$bool(true|false|string) (required)
Bool to convert. If a string is passed it will first be converted to a bool.

Changelog

Since 3.0.0 Introduced.

wc_bool_to_string() code WC 8.7.0

function wc_bool_to_string( $bool ) {
	if ( ! is_bool( $bool ) ) {
		$bool = wc_string_to_bool( $bool );
	}
	return true === $bool ? 'yes' : 'no';
}