Add wc_update_order_item() function

This commit is contained in:
Max Rice 2014-07-27 23:21:16 -04:00
parent c9342d6344
commit b192bd46f8
1 changed files with 22 additions and 0 deletions

View File

@ -217,6 +217,28 @@ function wc_add_order_item( $order_id, $item ) {
return $item_id;
}
/**
* Update an item for an order
*
* @since 2.2
* @param int $item_id
* @param array $args either `order_item_type` or `order_item_name`
* @return bool true if successfully updated, false otherwise
*/
function wc_update_order_item( $item_id, $args ) {
global $wpdb;
$update = $wpdb->update( $wpdb->prefix . 'woocommerce_order_items', $args, array( 'order_item_id' => $item_id ) );
if ( false === $update ) {
return false;
}
do_action( 'woocommerce_update_order_item', $item_id, $args );
return true;
}
/**
* Delete an item from the order it belongs to based on item id
*