【发布时间】:2018-06-22 01:13:43
【问题描述】:
我正在尝试根据订购的用户是否为“wholesale_customer”来编辑 Woocommerce 客户电子邮件。如果他们是我想编辑页脚文本以显示不同的名称并可能更改徽标,但此时名称更重要。
我正在使用 woocommerce_footer_text 函数尝试和编辑,但是当我测试它时,页脚文本没有显示。
有人可以帮忙吗?
add_filter( 'woocommerce_email_footer_text', 'woocommerce_footer_text', 10, 2 );
function woocommerce_footer_text( $get_option, $order ) {
$page = $_GET['page'] = isset( $_GET['page'] ) ? $_GET['page'] : '';
if ( 'wc-settings' === $page ) {
return $recipient;
}
// just in case
if ( ! $order instanceof WC_Order ) {
return $recipient;
}
//Get the customer ID
$customer_id = $order->get_user_id();
// Get the user data
$user_data = get_userdata( $customer_id );
// Adding an additional recipient for a custom user role
if ( in_array( 'wholesale_customer', $user_data->roles ) ) {
$get_option['business'] = 'Store 1';
} else {
$get_option['business'] = 'Store 2';
}
return $get_option;
}
【问题讨论】:
标签: php wordpress woocommerce user-roles email-notifications