WordPress at Your Fingertips
function is not described

wc_get_notice_data_attr() WC 3.9.0

Get notice data attribute.

No Hooks.

Return

String.

Usage

wc_get_notice_data_attr( $notice );
$notice(array) (required)
Notice data.

Changelog

Since 3.9.0 Introduced.

Code of wc_get_notice_data_attr() WC 5.6.0

function wc_get_notice_data_attr( $notice ) {
	if ( empty( $notice['data'] ) ) {
		return;
	}

	$attr = '';

	foreach ( $notice['data'] as $key => $value ) {
		$attr .= sprintf(
			' data-%1$s="%2$s"',
			sanitize_title( $key ),
			esc_attr( $value )
		);
	}

	return $attr;
}