WordPress at Your Fingertips
function is not described

WC_Data::meta_exists() public WC 3.0.0

See if meta data exists, since get_meta always returns a '' or array().

{} It's a method of the class: WC_Data{}

No Hooks.

Return

true|false.

Usage

$WC_Data = new WC_Data();
$WC_Data->meta_exists( $key );
$key(string)
Meta Key.
Default: ''

Changelog

Since 3.0.0 Introduced.

Code of WC_Data::meta_exists() WC 5.8.0

public function meta_exists( $key = '' ) {
	$this->maybe_read_meta_data();
	$array_keys = wp_list_pluck( $this->get_meta_data(), 'key' );
	return in_array( $key, $array_keys, true );
}