Add the winning bidder’s display name to the HTML Auction Finish email sent to staff. The template uses the winner recorded for the auction.
Note:
This is a developer-level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customization work. We are unable to provide support for customization under our Support Policy.
Before you start
↑ Back to topUse a test store with Auctions for WooCommerce 4.2.1 active, a child theme, and a fictional auction result. Under WooCommerce > Settings > Emails, check the Auction Finish recipients before using the template in production.
Override the HTML email template
↑ Back to topCopy templates/emails/auction_finish.php from the auctions-for-woocommerce plugin folder to woocommerce/emails/auction_finish.php in your child theme.
In the copied template, add this PHP after the winning-bid paragraph and before the WooCommerce email footer. Add it in PHP context or wrap the example in PHP tags.
if ( $product_data instanceof WC_Product_Auction ) {
$winner_id = (int) $product_data->get_auction_current_bider();
$winner = $winner_id ? get_userdata( $winner_id ) : false;
if ( $winner ) {
echo '<p><strong>Winner:</strong> ' . esc_html( $winner->display_name ) . '</p>';
}
}
Verify the staff email
↑ Back to topOn the test store, render the HTML email for a finished auction with a winner. Confirm that the recorded display name appears. Check an unsuccessful auction to confirm that the winner line appears only when the auction has a recorded winner. Use a test mailbox if you send a copy.
If the name is missing, check the email format, the child-theme override, and the recorded winner. To restore the original HTML, remove the added code or restore the previous template.
Questions and support
↑ Back to topSomething missing from this documentation? Still have questions and need assistance?
- If you have a question about an extension or theme you’d like to purchase, visit our contact page and use the AI Assistant or contact options.
- If you already purchased this product and need some assistance, get in touch with a Happiness Engineer via our support page and select this product’s name from the Product dropdown.