<?php
add_action( 'woocommerce_admin_order_totals_after_total', 'add_paypal_fee_order_admin' );
function add_paypal_fee_order_admin( $order_id ){
$paypalfee = get_post_meta( $order_id, 'PayPal Transaction Fee', true );
if($paypalfee){
$order = wc_get_order($order_id);
?>
<table class="wc-order-totals" style="border-top: 1px solid #999; margin-top:12px; padding-top:12px">
<tr>
<td class="label"><?php esc_html_e( 'PayPal Fee', 'woocommerce' ); ?>:</td>
<td width="1%"></td>
<td class="total">-$<?php echo $paypalfee; ?></td>
</tr>
<tr>
<td class="label"><?php esc_html_e( 'Amount Received', 'woocommerce' ); ?>:</td>
<td width="1%"></td>
<td class="total">
<?php echo wc_price( ($order->get_total() - $paypalfee), array( 'currency' => $order->get_currency() ) ); ?>
</td>
</tr>
</table>
<?php
}
}
?>
This code snippet works with the Paypal Standard Woocommerce Payment Gateway. It adds the PayPal fee and payout information to the WooCommerce Edit Order Screen.
If you are using WooCommerce PayPal Checkout Payment Gateway, this snippet is not needed. I am not sure about compatibility or necessity for any of the other many PayPal gateways.