wc_update_order_item()WC 2.2

Update an item for an order.

Hooks from the function

Return

true|false. True if successfully updated, false otherwise.

Usage

wc_update_order_item( $item_id, $args );
$item_id(int) (required)
Item ID.
$args(array) (required)
Either order_item_type or order_item_name.

Changelog

Since 2.2 Introduced.

wc_update_order_item() code WC 8.7.0

function wc_update_order_item( $item_id, $args ) {
	$data_store = WC_Data_Store::load( 'order-item' );
	$update     = $data_store->update_order_item( $item_id, $args );

	if ( false === $update ) {
		return false;
	}

	do_action( 'woocommerce_update_order_item', $item_id, $args );

	return true;
}