skip to Main Content

I am trying to add header & footer image in New account mail template in woocoomerce. Default template of new account is as follow

enter image description here

I am trying to add header & footer in this template only.(image attached for better clarification)

enter image description here

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


  1. Chosen as BEST ANSWER

    There was issue with https and http. 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.


  2. 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

    • It could also be some caching. It seem to remember caching with those emails being troublesome.
    • Have you tried simply setting a new header-image in the WooCommerce backend (WooCommerce >> Settings >> Email >> Header image)? There is a ‘Footer text’ in there as well.
    • I usually go for using a plugin when modifying the mails a lot, since it’s actually quite a bit of work (just so you’re aware).
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search