[REST API] Make easy to update order line items #11450

This commit is contained in:
Claudio Sanches 2016-07-19 14:11:44 -03:00
parent ea69a1ace8
commit 4ed8d46867
4 changed files with 4 additions and 5 deletions

View File

@ -1013,7 +1013,7 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
foreach ( $request[ $line ] as $item ) {
// Item ID is always required.
if ( ! array_key_exists( 'id', $item ) ) {
throw new WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID is required.', 'woocommerce' ), 400 );
$item['id'] = null;
}
// Create item.

View File

@ -575,7 +575,7 @@ class WC_API_Orders extends WC_API_Resource {
// Item ID is always required.
if ( ! array_key_exists( 'id', $item ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID is required', 'woocommerce' ), 400 );
$item['id'] = null;
}
// Create item.

View File

@ -609,10 +609,9 @@ class WC_API_Orders extends WC_API_Resource {
$update_totals = true;
foreach ( $data[ $line ] as $item ) {
// Item ID is always required.
if ( ! array_key_exists( 'id', $item ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID is required', 'woocommerce' ), 400 );
$item['id'] = null;
}
// Create item.

View File

@ -473,7 +473,7 @@ class WC_CLI_Order extends WC_CLI_Command {
// item ID is always required
if ( ! array_key_exists( 'id', $item ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID is required', 'woocommerce' ) );
$item['id'] = null;
}
// create item