【问题标题】:Send Billing Country name to Woocommerce admin Email Wordpress将帐单国家名称发送给 Woocommerce 管理员电子邮件 Wordpress
【发布时间】:2019-04-27 19:24:34
【问题描述】:

来自 function.php 文件。

<?php 
        add_action( 'woocommerce_email_after_order_table', 'woocommerce_add_billing_address_to_admin_emails', 15, 2 ); 
         ?>

【问题讨论】:

  • 您是在提问还是在回答?
  • @Frits 我认为您的答案标记了错误的人。 :)
  • @MohammadAshiqueAli oh lawd sorry 0_o 现在修复它!
  • 嗨 Mujahith iahi - 欢迎来到 Stack Overflow。本论坛采用问答形式。你的帖子似乎是对一个没有被问到的问题的答案。如果需要,您可以先发布您的问题,然后发布您的答案,但我建议首先查看该问题是否已被提出(这很可能),然后如果您的解决方案比较独特,则发布您对该问题的答案对同一问题的其他答案。祝你好运

标签: wordpress email woocommerce custom-fields country


【解决方案1】:

将此添加到您的 function.php 文件中。 :-)

<?php 
add_action( 'woocommerce_email_after_order_table', 'woocommerce_add_billing_address_to_admin_emails', 15, 2 ); 
function woocommerce_add_billing_address_to_admin_emails( $order, $is_admin_email ) { 
    if ( $is_admin_email ) { 
        echo '<div style="width:100%; background-color: #f2f2f2;">
            <p style="padding: 15px;margin: 15px 0;">Billing Country: <strong>'.WC()->countries->countries[ $order->billing_country ].'</strong></p>
            </div>';
    } 
} ?>

【讨论】:

    猜你喜欢
    • 2014-05-30
    • 2016-01-07
    • 2021-10-28
    • 2011-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-12
    • 2011-03-18
    相关资源
    最近更新 更多