WordPress at a glance
function is not described

WC_REST_Orders_V2_Controller::maybe_set_item_meta_data() protected WC 1.0

Maybe set item meta if posted.

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

No Hooks.

Return

Null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->maybe_set_item_meta_data( $item, $posted );
$item(WC_Order_Item) (required)
Order item data.
$posted(array) (required)
Request data.

Code of WC_REST_Orders_V2_Controller::maybe_set_item_meta_data() WC 5.0.0

<?php
protected function maybe_set_item_meta_data( $item, $posted ) {
	if ( ! empty( $posted['meta_data'] ) && is_array( $posted['meta_data'] ) ) {
		foreach ( $posted['meta_data'] as $meta ) {
			if ( isset( $meta['key'] ) ) {
				$value = isset( $meta['value'] ) ? $meta['value'] : null;
				$item->update_meta_data( $meta['key'], $value, isset( $meta['id'] ) ? $meta['id'] : '' );
			}
		}
	}
}