Automattic\WooCommerce\Internal\DataStores

CustomMetaDataStore::read_meta()publicWC 1.0

Returns an array of meta for an object.

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

No Hooks.

Return

Array.

Usage

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

Code of CustomMetaDataStore::read_meta() WC 7.1.0

public function read_meta( &$object ) {
	global $wpdb;

	$db_info = $this->get_db_info();

	// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
	$raw_meta_data = $wpdb->get_results(
		$wpdb->prepare(
			"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 meta_id",
			$object->get_id()
		)
	);
	// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared

	return $raw_meta_data;
}