wc_update_order_item()
Update an item for an order.
Hooks from the function
Returns
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_typeororder_item_name.
Changelog
| Since 2.2 | Introduced. |
wc_update_order_item() wc update order item code WC 10.5.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;
}