[REST API] Make easy to update order line items #11450
This commit is contained in:
parent
ea69a1ace8
commit
4ed8d46867
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue