Cannot override WooCommerce email template on Pro child theme

Hi there,

With my recent upgrade from X to Pro, I couldn’t override WooCommerce email template.

Also, I can’t seem to update functions.php file with the error … that I have to use SFTP…
Is there anything I should check?

Thank you!

Hi Khim,

Thank you for writing in, please move your email template to pro child theme, please follow the guide provided here.

Maybe you’re only allowed to use SFTP, please use SFTP instead, if you can’t still connect with SFTP please contact your hosting regarding this matter.

Let us know how it goes,
Cheers!

Thank you @friech for your prompt reply.

The override was working using X child theme. It looks quite straight forward as attached, just that it’s not loading:

It works once it’s reverted, i.e. if I didn’t override.

I suspect the pro child theme is the culprit here…

Thanks you!

Hi Khim,

I see that you have WooCommerce 3.5.3, As of today the supported version of WooCommerce is 3.5.1. Please rollback to version 3.5.1 to avoid any potential compatibility issues.

You can download WooCommerce 3.5.1 from here (see at the bottom of that page)

If you get an error after downgrading, please follow the solution provided here.

Thanks.

Hi @friech,

I’ve rolled back to 3.5.1.

I looked at the solution provided and the issues were different:
I’m using Pro instead of X. I didn’t have the same error message as mentioned in that solution.

My problem is not able to load the pro-child theme and therefore unable to override WooCommerce Settings of email.

Thanks!

Hey Khim,

​To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

To do this, you can create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to post a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

Thank you.

Hi @RueNel,

I’ve just attached the login credential in the previous note.

Thanks!

Hello Khim,

The login details seems incorrect. It failed we we log in.
Please double check it.

Thanks.

Oopss… Here you go again.

Thanks!

Hello Khim,

It appears that you are already using Pro child theme and it is also active already. In this child theme, there is no override for the email. To resolve your issue, since you have your child theme active and ready, please follow the following steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file

<?php
/**
 * Customer new account email
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-new-account.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce/Templates/Emails
 * @version 3.5.2
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

?>

<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>

<?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( __( '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' ) ) ) ); ?></p><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>

<?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; ?>

<p><?php esc_html_e( 'We look forward to seeing you soon.', 'woocommerce' ); ?></p>

<?php
do_action( 'woocommerce_email_footer', $email );

3] Save the file named as customer-new-account.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/pro-child/woocommerce/emails/

You may not have this folder path yet so you’ll have to create it.

And by the way, I noticed that you are using PHP version 5.6.37 and WordPress 5.0 requires at least 7.2 (https://wordpress.org/about/requirements/). In most cases you cannot update your PHP version yourself and need to contact your host about this. The upgrade process is an easy process and should be something your host can do for you without affecting your website or charging you for it. Here’s a letter you can send to your hosting company:

Dear host,

I’m interested in running the open-source WordPress <https://wordpress.org/> web software and I was wondering if my account supported the following:

- PHP 7.2 or greater
- MySQL 5.6 or greater OR MariaDB 10.0 or greater
- Nginx or Apache with mod_rewrite module
- HTTPS support

Thanks!

Hope this helps. Kindly let us know.

Hi @RueNel,

I finally figured out a very minor syntax error of an apostrophe.
It all seems to work now :slight_smile:

Another question: How to hide author and date from a post?

Thank you.

Hi Khim,

To remove the author and date meta from the posts, please navigate to Pro > Theme Options > Blog and turn off the Post Meta.



If you have a follow up question, we kindly ask to write it on a new thread as this one is getting longer and harder to follow.

Cheers!

Will do.

Thank you,
Khim

You’re most welcome, Khim.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.