Merge pull request #30957 from drjamesj/fix/30400_double_negative_refund_values
Fixes #30400 by multiplying refund values by -1
This commit is contained in:
commit
c6bdff0d59
|
@ -35,8 +35,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php
|
||||
echo wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) );
|
||||
|
||||
if ( $refunded = $order->get_total_refunded_for_item( $item_id, 'fee' ) ) {
|
||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
if ( $refunded = -1 * $order->get_total_refunded_for_item( $item_id, 'fee' ) ) {
|
||||
echo '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -59,8 +59,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php
|
||||
echo ( '' !== $tax_item_total ) ? wc_price( wc_round_tax_total( $tax_item_total ), array( 'currency' => $order->get_currency() ) ) : '–';
|
||||
|
||||
if ( $refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id, 'fee' ) ) {
|
||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
if ( $refunded = -1 * $order->get_tax_refunded_for_item( $item_id, $tax_item_id, 'fee' ) ) {
|
||||
echo '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -59,10 +59,10 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
|||
<?php
|
||||
echo '<small class="times">×</small> ' . esc_html( $item->get_quantity() );
|
||||
|
||||
$refunded_qty = $order->get_qty_refunded_for_item( $item_id );
|
||||
$refunded_qty = -1 * $order->get_qty_refunded_for_item( $item_id );
|
||||
|
||||
if ( $refunded_qty ) {
|
||||
echo '<small class="refunded">-' . esc_html( $refunded_qty * -1 ) . '</small>';
|
||||
echo '<small class="refunded">' . esc_html( $refunded_qty * -1 ) . '</small>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -108,10 +108,10 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
|||
echo '<span class="wc-order-item-discount">' . sprintf( esc_html__( '%s discount', 'woocommerce' ), wc_price( wc_format_decimal( $item->get_subtotal() - $item->get_total(), '' ), array( 'currency' => $order->get_currency() ) ) ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
$refunded = $order->get_total_refunded_for_item( $item_id );
|
||||
$refunded = -1 * $order->get_total_refunded_for_item( $item_id );
|
||||
|
||||
if ( $refunded ) {
|
||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -156,10 +156,10 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
|
|||
echo '–';
|
||||
}
|
||||
|
||||
$refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id );
|
||||
$refunded = -1 * $order->get_tax_refunded_for_item( $item_id, $tax_item_id );
|
||||
|
||||
if ( $refunded ) {
|
||||
echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -64,9 +64,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<div class="view">
|
||||
<?php
|
||||
echo wp_kses_post( wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) ) );
|
||||
$refunded = $order->get_total_refunded_for_item( $item_id, 'shipping' );
|
||||
$refunded = -1 * $order->get_total_refunded_for_item( $item_id, 'shipping' );
|
||||
if ( $refunded ) {
|
||||
echo wp_kses_post( '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>' );
|
||||
echo wp_kses_post( '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>' );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -89,9 +89,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<div class="view">
|
||||
<?php
|
||||
echo wp_kses_post( ( '' !== $tax_item_total ) ? wc_price( $tax_item_total, array( 'currency' => $order->get_currency() ) ) : '–' );
|
||||
$refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id, 'shipping' );
|
||||
$refunded = -1 * $order->get_tax_refunded_for_item( $item_id, $tax_item_id, 'shipping' );
|
||||
if ( $refunded ) {
|
||||
echo wp_kses_post( '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>' );
|
||||
echo wp_kses_post( '<small class="refunded">' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>' );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue