WC_REST_Orders_V2_Controller::filter_internal_meta_keys()privateWC 1.0

With HPOS, few internal meta keys such as _billing_address_index, _shipping_address_index are not considered internal anymore (since most internal keys were flattened into dedicated columns).

This function helps in filtering out any remaining internal meta keys with HPOS is enabled.

Method of the class: WC_REST_Orders_V2_Controller{}

No Hooks.

Return

Array. Filtered order meta data.

Usage

// private - for code of main (parent) class only
$result = $this->filter_internal_meta_keys( $meta_data );
$meta_data(array) (required)
Order meta data.

WC_REST_Orders_V2_Controller::filter_internal_meta_keys() code WC 8.9.0

private function filter_internal_meta_keys( $meta_data ) {
	if ( ! OrderUtil::custom_orders_table_usage_is_enabled() ) {
		return $meta_data;
	}
	$cpt_hidden_keys = ( new \WC_Order_Data_Store_CPT() )->get_internal_meta_keys();
	$meta_data       = array_filter(
		$meta_data,
		function ( $meta ) use ( $cpt_hidden_keys ) {
			return ! in_array( $meta->key, $cpt_hidden_keys, true );
		}
	);
	return array_values( $meta_data );
}