I am trying to add header & footer image in New account mail template in woocoomerce. Default template of new account is as follow
I am trying to add header & footer in this template only.(image attached for better clarification)
Issue – Added Images are not showing in user’s mail box.
What i have tried –
I copied the customer-new-account.php file to my child theme folder & added the image. But it does not showing the image in.
Path of file –
my-child-theme/woocommerce/emails/customer-new-account.php.
My custom code is –
defined( 'ABSPATH' ) || exit;
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<img src= 'Path of header image'>
<?php /* translators: %s: Customer username */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p>
<?php /* translators: %1$s: Site title, %2$s: Username, %3$s: My account link */ ?>
<p><?php printf( esc_html__( 'Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
<?php /* translators: %s: Auto generated password */ ?>
<p><?php printf( esc_html__( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
<?php endif; ?>
<?php
/**
* Show user-defined additional content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
<img src= 'Path of footer image'>
do_action( 'woocommerce_email_footer', $email );
Any Advice ?
2
Answers
There was issue with
https
andhttp
. The SSL-certificate was expired for the domain I was working on.Due to this image was not displaying in user's mailbox. After fixing the SSL issue everything started working.
It could be a couple of things.
My best guess
Is that you didn’t put the template in the right location. That’s a classic. So if it was me, then I would first ensure that ‘customer-new-account.php` is in the right place. Perhaps read more about it here WooCommerce template structure
Other comments