WC_Data_Store_WP::read_meta()publicWC 3.0.0

Returns an array of meta for an object.

Method of the class: WC_Data_Store_WP{}

No Hooks.

Return

Array.

Usage

$WC_Data_Store_WP = new WC_Data_Store_WP();
$WC_Data_Store_WP->read_meta( $object );
$object(WC_Data) (required) (passed by reference — &)
WC_Data object.

Changelog

Since 3.0.0 Introduced.

WC_Data_Store_WP::read_meta() code WC 9.4.2

public function read_meta( &$object ) {
	global $wpdb;
	$db_info       = $this->get_db_info();
	$raw_meta_data = $wpdb->get_results(
		$wpdb->prepare(
			// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
			"SELECT {$db_info['meta_id_field']} as meta_id, meta_key, meta_value
			FROM {$db_info['table']}
			WHERE {$db_info['object_id_field']} = %d
			ORDER BY {$db_info['meta_id_field']}",
			// phpcs:enable
			$object->get_id()
		)
	);
	return $this->filter_raw_meta_data( $object, $raw_meta_data );
}