admin管理员组文章数量:1393052
I'm using Woocommerce Simple auctions plugin. When an auction finishes the admin gets an email saying the following:
The auction for (Auction name). Winning bid is R5,000.
This is the code for that template:
<?php
/**
* Admin auction finish email
*
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$product_data = wc_get_product( $product_id );
?>
<?php do_action('woocommerce_email_header', $email_heading, $email); ?>
<p><?php printf( __( "The auction for <a href='%s'>%s</a> finished. Winning bid is %s. ", 'wc_simple_auctions' ),get_permalink($product_id), $product_data->get_title(), wc_price($product_data->get_curent_bid())); ?></p>
<p><?php do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); ?></p>
<?php do_action('woocommerce_email_footer', $email); ?>
Is there any way for me to include the customer billing details in this mail?
I'm using Woocommerce Simple auctions plugin. When an auction finishes the admin gets an email saying the following:
The auction for (Auction name). Winning bid is R5,000.
This is the code for that template:
<?php
/**
* Admin auction finish email
*
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$product_data = wc_get_product( $product_id );
?>
<?php do_action('woocommerce_email_header', $email_heading, $email); ?>
<p><?php printf( __( "The auction for <a href='%s'>%s</a> finished. Winning bid is %s. ", 'wc_simple_auctions' ),get_permalink($product_id), $product_data->get_title(), wc_price($product_data->get_curent_bid())); ?></p>
<p><?php do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); ?></p>
<?php do_action('woocommerce_email_footer', $email); ?>
Is there any way for me to include the customer billing details in this mail?
Share Improve this question edited Feb 22, 2020 at 18:21 7uc1f3r 2292 silver badges7 bronze badges asked Feb 22, 2020 at 13:44 labworxsalabworxsa 215 bronze badges1 Answer
Reset to default 0Either you work with a hook
function include_customer_details( $order, $sent_to_admin, $plain_text, $email ) {
// Only admin need to know.
if ( !$sent_to_admin ) {
return;
}
// test first, then delete the line below and complete the if statement
echo '<pre>', print_r($email->id, 1), '</pre>';
/*
if ( $email->id == 'paste result from test mail' ) {
echo 'my extra text';
}
*/
}
add_action('woocommerce_email_customer_details', 'include_customer_details', 10, 4 );
Or adjust the template file, because you have access to $order you can get easily order info
More information:
https://businessbloomer/woocommerce-easily-get-order-info-total-items-etc-from-order-object/
<?php
/**
* Admin auction finish email
*
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$product_data = wc_get_product( $product_id );
?>
<?php do_action('woocommerce_email_header', $email_heading, $email); ?>
<p><?php printf( __( "The auction for <a href='%s'>%s</a> finished. Winning bid is %s. ", 'wc_simple_auctions' ),get_permalink($product_id), $product_data->get_title(), wc_price($product_data->get_curent_bid())); ?></p>
<p><?php echo '<pre>', print_r($product_data, 1), '</pre>'; //etc... ?></p>
<p><?php do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); ?></p>
<?php do_action('woocommerce_email_footer', $email); ?>
本文标签: Include customer details in woocommerce 3rd part plugin email
版权声明:本文标题:Include customer details in woocommerce 3rd part plugin email 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744717175a2621473.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论