WordPress at Your Fingertips
function is not described

WC_REST_Orders_V2_Controller::maybe_set_item_prop() protected WC 1.0

Maybe set an item prop if the value was 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_prop( $item, $prop, $posted );
$item(WC_Order_Item) (required)
Order item.
$prop(string) (required)
Order property.
$posted(array) (required)
Request data.

Code of WC_REST_Orders_V2_Controller::maybe_set_item_prop() WC 5.9.0

protected function maybe_set_item_prop( $item, $prop, $posted ) {
	if ( isset( $posted[ $prop ] ) ) {
		$item->{"set_$prop"}( $posted[ $prop ] );
	}
}