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: ''
Return Return
(boolean)
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 );
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |