Correction to last commit to deal with tax arrays

This commit is contained in:
Mike Jolley 2014-09-08 12:45:32 +01:00
parent a588442cbb
commit ebed8dbc85
1 changed files with 4 additions and 4 deletions

View File

@ -1812,8 +1812,8 @@ class WC_AJAX {
$refund_amount = wc_format_decimal( sanitize_text_field( $_POST['refund_amount'] ) );
$refund_reason = sanitize_text_field( $_POST['refund_reason'] );
$line_item_qtys = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_qtys'] ) ), true );
$line_item_totals = array_map( 'wc_format_decimal', json_decode( sanitize_text_field( stripslashes( $_POST['line_item_totals'] ) ), true ) );
$line_item_tax_totals = array_map( 'wc_format_decimal', json_decode( sanitize_text_field( stripslashes( $_POST['line_item_tax_totals'] ) ), true ) );
$line_item_totals = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_totals'] ) ), true );
$line_item_tax_totals = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_tax_totals'] ) ), true );
$api_refund = $_POST['api_refund'] === 'true' ? true : false;
$restock_refunded_items = $_POST['restock_refunded_items'] === 'true' ? true : false;
@ -1850,10 +1850,10 @@ class WC_AJAX {
}
}
foreach ( $line_item_totals as $item_id => $total ) {
$line_items[ $item_id ]['refund_total'] = $total;
$line_items[ $item_id ]['refund_total'] = wc_format_decimal( $total );
}
foreach ( $line_item_tax_totals as $item_id => $tax_totals ) {
$line_items[ $item_id ]['refund_tax'] = $tax_totals;
$line_items[ $item_id ]['refund_tax'] = array_map( 'wc_format_decimal', $tax_totals );
}
// Create the refund object