WC_Data::meta_exists()
See if meta data exists, since get_meta always returns a '' or array().
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. |
WC_Data::meta_exists() WC Data::meta exists code WC 8.7.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 ); }