From ff50570b5c4852c889a31be1c5a3ec2c4ee0fd2b Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 28 Jun 2016 14:44:01 -0300 Subject: [PATCH] [REST API] Check if tax subtotal exists before to prevent errors, closes #11270 --- includes/api/class-wc-rest-orders-controller.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/api/class-wc-rest-orders-controller.php b/includes/api/class-wc-rest-orders-controller.php index d9679e32fd1..16321ec29bd 100644 --- a/includes/api/class-wc-rest-orders-controller.php +++ b/includes/api/class-wc-rest-orders-controller.php @@ -300,8 +300,10 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller { ); } - foreach ( $fee_line_taxes['subtotal'] as $tax_rate_id => $tax ) { - $fee_tax[ $tax_rate_id ]['subtotal'] = $tax; + if ( isset( $fee_line_taxes['subtotal'] ) ) { + foreach ( $fee_line_taxes['subtotal'] as $tax_rate_id => $tax ) { + $fee_tax[ $tax_rate_id ]['subtotal'] = $tax; + } } $fee_line['taxes'] = array_values( $fee_tax );