How to change the color and bold of the text in this message sent to an email address?
'The coupon code "%s" has been applied by a customer'
// For all Woocommerce versions (since 3.0)
add_action( 'woocommerce_checkout_update_order_meta', 'custom_email_for_orders_with_applied_coupon' );
function custom_email_for_orders_with_applied_coupon( $order_id ){
$order = wc_get_order( $order_id );
$used_coupons = $order->get_used_coupons();
if( ! empty($used_coupons) ){
foreach ( $used_coupons as $coupon_code ) {
$coupon = new WC_Coupon( $coupon_code ); // WC_Coupon Object
$recipient = $coupon->get_meta('email_recipient'); // get recipient
if( ! empty($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( $recipient, $subject, $content ); // Send email
}
}
}
}
I’m trying to get a css or other styling effect for an email reply
4
Answers
Below is the solution to my problem.
Did you try HTML? You can add inline css like this:
<span style="color:red">word</span>
In case HTML body is not the default of
wp_mail
which Is the case, you should add the following header:change this line:
to:
Change this:
To this: