wc_update_order_item()WC 2.2

Update an item for an order.

Хуки из функции

Возвращает

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

Использование

wc_update_order_item( $item_id, $args );
$item_id(int) (обязательный)
Item ID.
$args(массив) (обязательный)
Either order_item_type or order_item_name.

Список изменений

С версии 2.2 Введена.

Код wc_update_order_item() 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;
}