WC_Data::meta_exists( string $key = '' )

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


Description Description


Parameters Parameters

$key

(Optional) Meta Key.

Default value: ''


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/abstracts/abstract-wc-data.php

	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 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.