0

我们正在使用 Woocommerce Payments,在我们的订单确认电子邮件中,付款方式显示为 Woocommerce Payments,而不是 Visa、Mastercard 等付款来源。

在此处输入图像描述

我已经找到了如何完全删除付款方式(见下文),但我将如何删除它并重新添加到付款来源?

<tfoot>
<?php
    if ( $totals = $order->get_order_item_totals() ) {
        $i = 0;
        foreach ( $totals as $key => $total ) {
            $i++;
            if ( $key !== 'payment_method' ){
                ?><tr>
                    <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
                    <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
                </tr><?php
            }
        }
    }
?>
4

1 回答 1

1

在你的functions.php中添加这个

add_filter( 'woocommerce_get_order_item_totals', 'change_payment_method_name_in_emails', 10, 3 );
function change_payment_method_name_in_emails( $total_rows, $order, $tax_display ){
    // On Email notifications only
    if ( ! is_wc_endpoint_url() ) {
        if($total_rows['payment_method']['value'] === 'Woocommerce Payments'){
            $total_rows['payment_method']['value'] = 'Visa/Master';
        }
    }
    return $total_rows;
}
于 2021-11-09T07:43:09.510 回答