Okay
  Public Ticket #3444536
approval Email template customization
Closed

Comments

  • Aumair started the conversation

    Hi,

    I am trying to change email template of the approval email according to the documentation.

    I modified the code like this and placed it in the theme folder

    <?php

    defined( 'ABSPATH' ) || exit;

    /*
     * @hooked WC_Emails::email_header() Output the email header
     */
    do_action( 'woocommerce_email_header', $email_heading, $email );

    $user = get_user_by('email', $email->recipient);
    $first_name = get_user_meta($user->ID, 'billing_first_name', true);

    if (!empty($first_name)){
    echo esc_html__('Hi ','b2bking').$first_name;
    echo '<br>';
    }
    ?>
    <p>

    <br /><br />
    <?php esc_html_e( 'If you need assistance in making your first order, please do not hesitate to contact us at [email protected] or give us a call at 800-523-5567.', 'b2bking'); ?>
    <br /><br />
    <?php esc_html_e( 'Thanks.', 'b2bking'); ?>

    <?php // If the password has not been set by the user during the sign-up process, send them a link to set a new password ?>
    <p><a href="<?php echo esc_attr( $set_password_url ); ?>"><?php printf( esc_html__( 'Click here to set your new password.', 'b2bking' ) ); ?></a></p>

    </p>

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

    /*
     * @hooked WC_Emails::email_footer() Output the email footer
     */
    do_action( 'woocommerce_email_footer', $email );



    I do get an email with only the text to set password, not hyperlinked and so the customer cannot set the password for this approved account.

    There must be something wrong in this part here:

    <?php // If the password has not been set by the user during the sign-up process, send them a link to set a new password ?>
    <p><a href="<?php echo esc_attr( $set_password_url ); ?>"><?php printf( esc_html__( 'Click here to set your new password.', 'b2bking' ) ); ?></a></p>


    Can you please help me sort this out.


    Thank you

  •  2,218
    WebWizards replied

    Hi there,

    Thank you for purchasing our plugin!


    I sent you a message on Facebook. Generally the best way to handle it, what we recommend when you use manual approval is to just allow the customer to choose their own password.

    This is because otherwise the flow can be confusing for the customer.


    You can go to WooCommerce -> Settings -> Accounts and disable this option:

    8193192732.png



    Then the customer can choose their own password directly during registration:

    6816198294.png


    In your code, the problem is you do not have the $set_password_url - this variable is not available in this email.


    Kind regards,

    Stefan