Help and Contact Box in Customer Emails
Adds a short "Questions about your order?" box with your phone number and email to the bottom of customer order emails.
Opens WPIDE on
Code
$wpide_email_help = array(
'title' => 'Questions about your order?',
'text' => 'Just reply to this email or call us on 020 7946 0000 (Mon to Fri, 9am to 5pm).',
);
add_action( 'woocommerce_email_customer_details', function ( $order, $sent_to_admin, $plain_text ) use ( $wpide_email_help ) {
if ( $sent_to_admin ) {
return;
}
if ( $plain_text ) {
echo "\n" . esc_html( $wpide_email_help['title'] ) . "\n" . esc_html( $wpide_email_help['text'] ) . "\n";
return;
}
printf( '<div style="margin:24px 0 0;padding:16px;background:#f6f7f7;border-radius:4px"><strong>%1$s</strong><br>%2$s</div>', esc_html( $wpide_email_help['title'] ), esc_html( $wpide_email_help['text'] ) );
}, 30, 3 );
Notes
Edit the text and contact details at the top; emails sent to the shop are left unchanged.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.