WordPress at a glance
function is not described

wc_format_hex() WC 1.0

Format string as hex.

No Hooks.

Return

String|null. Nothing.

Usage

wc_format_hex( $hex );
$hex(string) (required)
HEX color.

Code of wc_format_hex() WC 5.3.0

<?php
function wc_format_hex( $hex ) {
	$hex = trim( str_replace( '#', '', $hex ) );

	if ( strlen( $hex ) === 3 ) {
		$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
	}

	return $hex ? '#' . $hex : null;
}