[REST API] Check if tax subtotal exists before to prevent errors, closes #11270

This commit is contained in:
Claudio Sanches 2016-06-28 14:44:01 -03:00
parent cf622677ad
commit ff50570b5c
1 changed files with 4 additions and 2 deletions

View File

@ -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 );