• Resolved richsadams

    (@richsadams)


    Hello. I just installed your plugin and it’s working great. However I would like to change where the confirmation text and link appears in the welcome email. I found a smilier post and followed the directions, but it doesn’t seem to work.

    In the advanced area I’ve checked “Choose precisely where the activation email will be appended to the “Customer new account” email” and tried adding the recommended code to a copy of the templates/emails/customer-new-account.php in my child theme:

    do_action( “alg_wc_ev_activation_email_content_placeholder”, $email->object );

    Unless I place it at the very top, it either doesn’t show or it causes a fatal error. I spent a few hours on it so I’m sure my syntax is wrong somewhere.

    I know the file in my child theme is working as I can change the other text and see it displayed in the welcome email, but I just can’t sort out exactly how to add your code snippet so that it appears where I want it.

    I would simply like the “Please click on the following link” and the link itself to appear directly after the salutation “Hi username”

    Below is the original php code. Would you be so kind as to update it with the exact code to accomplish this?

    Thanks very much!

    defined( 'ABSPATH' ) || exit;
    
    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( 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 ) ) );
    }
    
    do_action( 'woocommerce_email_footer', $email );
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter richsadams

    (@richsadams)

    So I’ll answer my own support request.

    Instead of moving the plugin’s text and link in the /woocommerce/templates/emails/customer-new-account.php file, I ended up re-writing the the file itself. (The new file is located in the child theme.)

    I removed the “My Account” link and reworded it so that there’s no confusion about what to do… click on the verification link (which takes them to the My Account page anyway). Done.

    I unchecked the “Choose precisely where the activation email will be appended to the “Customer new account” email” box in the plugin’s Advanced section since I’m not actually moving the code to a new location.

    It’s working perfectly but if you see any issues with the code, please let me know so that I can update it!

    defined( 'ABSPATH' ) || exit;
    
    do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
    <?php /* translators: %s: Customer username */ ?>
    <p><?php printf( esc_html__( 'Welcome!', '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 at %1$s. Please click on the link at the bottom of this email to activate your account. After confirming your email you can view your orders, add your address, phone and more. Later just log in with your email, %2$s, and password for super-fast checkout!', 'woocommerce' ), esc_html( $blogname ), '<strong>' . esc_html( $user_login ) . '</strong>', ); // 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 ) ) );
    }
    
    do_action( 'woocommerce_email_footer', $email );
    Plugin Author WPFactory

    (@wpcodefactory)

    Hello @richsadams ,

    Apparently there are no issues with your code.
    Actually, the email templates provided by WooCommerce are there so you can change as you wish ??

    I’m thinking that maybe when you used the action in the middle of the template, you could have forgotten to use the php tags. When you use it at the top, it’s not necessary. In the end it has to be like this if you use it in the middle:
    <?php do_action( "alg_wc_ev_activation_email_content_placeholder", $email->object ); ?>

    • This reply was modified 3 years, 8 months ago by WPFactory.
    Thread Starter richsadams

    (@richsadams)

    Thanks so much for the prompt reply. I believe you are correct. I tried the slip it inside other code lines and that did not work.

    I’m pretty happy with the result I got with the code I posted above, but I may revisit this in the future.

    Thank you again and keep up the great work!

    • This reply was modified 3 years, 8 months ago by richsadams. Reason: Typo
    Plugin Author WPFactory

    (@wpcodefactory)

    Thanks ??

    In that case, please consider leaving a review if you are enjoying the plugin/support. It would be much appreciated ??

    Thread Starter richsadams

    (@richsadams)

    5 Stars? Done!

    Thanks again and best wishes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change Text and Link In Welcome Email’ is closed to new replies.