Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes

CustomMetaBox::get_formatted_order_meta_data()privateWC 1.0

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

No Hooks.

Return

Array. Meta data.

Usage

// private - for code of main (parent) class only
$result = $this->get_formatted_order_meta_data( $order );
$order(\WC_Order) (required)
Order object.

Code of CustomMetaBox::get_formatted_order_meta_data() WC 7.1.0

private function get_formatted_order_meta_data( \WC_Order $order ) {
	$metadata         = $order->get_meta_data();
	$metadata_to_list = array();
	foreach ( $metadata as $meta ) {
		$data = $meta->get_data();
		if ( is_protected_meta( $data['key'], 'order' ) ) {
			continue;
		}
		$metadata_to_list[] = array(
			'meta_id'    => $data['id'],
			'meta_key'   => $data['key'], // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- False positive, not a meta query.
			'meta_value' => maybe_serialize( $data['value'] ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value -- False positive, not a meta query.
		);
	}
	return $metadata_to_list;
}