I found the code below which is sending an e-mail once a specific coupon code has been used, however the order details are obviously not visible in the content since it's only the defined text:
add_action( 'woocommerce_applied_coupon', 'custom_email_on_applied_coupon', 10, 1 );
function custom_email_on_applied_coupon( $coupon_code ){
if( $coupon_code == 'bob' ){
$to = "jack.hoover@gmail.com"; // Recipient
$subject = sprintf( __('Coupon "%s" has been applied'), $coupon_code );
$content = sprintf( __('The coupon code "%s" has been applied by a customer'), $coupon_code );
wp_mail( $to, $subject, $content );
}
}
Is there any possibilty to send order details in the content (message) such as {customer_name}, {order_number} or {coupon_amount}? If not, how can a new order be sent to an additional recipient only if that specific coupon code is used. Thanks for any assistance.
I've added the email variables added in the question, however I guess the trigger to understand which order it is and the order details in it should be included to my knowledge in order to get it running.