wc_generate_order_key()WC 3.5.4

Generate an order key with prefix.

Hooks from the function

Return

String. The order key.

Usage

wc_generate_order_key( $key );
$key(string)
Order key without a prefix. By default generates a 13 digit secret.
Default: ''

Changelog

Since 3.5.4 Introduced.

wc_generate_order_key() code WC 9.4.2

function wc_generate_order_key( $key = '' ) {
	if ( '' === $key ) {
		$key = wp_generate_password( 13, false );
	}

	return 'wc_' . apply_filters( 'woocommerce_generate_order_key', 'order_' . $key );
}