diff --git a/includes/api/v2/class-wc-api-orders.php b/includes/api/v2/class-wc-api-orders.php index cdcfa3b9979..c3f2f389090 100644 --- a/includes/api/v2/class-wc-api-orders.php +++ b/includes/api/v2/class-wc-api-orders.php @@ -866,7 +866,8 @@ class WC_API_Orders extends WC_API_Resource { */ protected function set_line_item( $order, $item, $action ) { - $creating = ( 'create' === $action ); + $creating = ( 'create' === $action ); + $item_args = array(); // product is always required if ( ! isset( $item['product_id'] ) && ! isset( $item['sku'] ) ) { @@ -919,8 +920,6 @@ class WC_API_Orders extends WC_API_Resource { throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity is required', 'woocommerce' ), 400 ); } - $item_args = array(); - // quantity if ( isset( $item['quantity'] ) ) { $item_args['qty'] = $item['quantity'];