Merge pull request #7139 from splashingpixels/order-details-refunded

Order details refunded, closes #7138
This commit is contained in:
Claudio Sanches 2015-01-18 09:20:10 -02:00
commit 0a8a506e1f
1 changed files with 34 additions and 12 deletions

View File

@ -4,7 +4,7 @@
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2.0
* @version 2.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -88,25 +88,47 @@ $order = wc_get_order( $order_id );
</tbody>
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) foreach ( $totals as $total ) :
$has_refund = false;
if ( $order->get_total_refunded() !== NULL ) {
$has_refund = true;
}
if ( $totals = $order->get_order_item_totals() ) foreach ( $totals as $key => $total ) :
$value = $total['value'];
// check for refund
if ( $has_refund && $key === 'order_total' ) {
$value = '<del>' . strip_tags( $order->get_formatted_order_total() ) . '</del> <ins>' . wc_price( $order->get_total() - $order->get_total_refunded(), array( 'currency' => $order->get_order_currency() ) ) . '</ins>';
}
?>
<tr>
<th scope="row"><?php echo $total['label']; ?></th>
<td><?php echo $total['value']; ?></td>
<td><?php echo $value; ?></td>
</tr>
<?php
endforeach;
// Check for customer note
if ( '' != $order->customer_note ) {
// check for refund
if ( $has_refund ) {
?>
<tr>
<th scope="row"><?php _e( 'Refunded:', 'woocommerce' ); ?></th>
<td>-<?php echo wc_price( $order->get_total_refunded(), array( 'currency' => $order->get_order_currency() ) ); ?></td>
</tr>
<?php
}
// Check for customer note
if ( '' != $order->customer_note ) {
?>
<tr>
<th scope="row"><?php _e( 'Note:', 'woocommerce' ); ?></th>
<td><?php echo wptexturize( $order->customer_note ); ?></td>
</tr>
<?php
}
?>
<tr>
<th scope="row"><?php _e( 'Note:', 'woocommerce' ); ?></th>
<td><?php echo wptexturize( $order->customer_note ); ?></td>
</tr>
<?php
}
?>
</tfoot>
</table>