Only display the "Paid by customer" section if the order has been paid

This commit changes the condition in the if the statement that decides
whether or not to display the "Paid by customer" section in the order admin
page. Before it, this section was displayed for all orders that
contained one of the following statuses: 'processing', 'completed' or 'refunded'.

The problem with this approach is that offline payment gateways, like
'Cash on Delivery', set the order status to processing when the order is
placed but before the customer pays for it. So the "Paid by customer"
section was being displayed in some cases where the order was not
actually paid yet creating a confusing experience to store managers.

To fix this, this commit also checks for the presence of the
`_date_paid` order meta. If this order meta is present and the order
status corresponds to one of the three statuses listed above, it means that
the order has been paid and we can display the "Paid by customer"
section. If this order meta is not present, we don't display the "Paid
by customer" section.
This commit is contained in:
Rodrigo Primo 2020-02-05 16:08:13 -03:00
parent 147266f44f
commit 44ecb0ec9e
1 changed files with 1 additions and 1 deletions

View File

@ -209,7 +209,7 @@ if ( wc_tax_enabled() ) {
<div class="clear"></div> <div class="clear"></div>
<?php if ( in_array( $order->get_status(), array( 'processing', 'completed', 'refunded' ) ) ) : ?> <?php if ( in_array( $order->get_status(), array( 'processing', 'completed', 'refunded' ) ) && ! empty( $order->get_date_paid() ) ) : ?>
<table class="wc-order-totals" style="border-top: 1px solid #999; margin-top:12px; padding-top:12px"> <table class="wc-order-totals" style="border-top: 1px solid #999; margin-top:12px; padding-top:12px">
<tr> <tr>