I actually wish to have a custom email when a user signs up on the website.
Here is the existing code:
<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>
current result:
Thanks for creating an account on (website name). Your username is (user name). You can access your account area to view orders, change your password, and more at: https://www.(website name).com/beta/my-account/
I wish to have this message:
Thank you for signing up. Message us 1000 on WhatsApp to select your free gift with your first purchase. Click Here (click here has a link to WhatsApp).
I am done with the text part but stuck with Click here. Please let me know the code and its placement. Thank you for helping!
Advertisement
Answer
I am guessing you want to change the default email template when a user creates a new account.
This email template can be found at : woocommerce/templates/emails/customer-new-account.php
and the line you wish to change is L25 here.
If you go through the documentation Template structure & Overriding templates via a theme you will see.
Edit files in an upgrade-safe way using overrides. Copy the template into a directory within your theme named /woocommerce keeping the same file structure but removing the /templates/ subdirectory.
Example: To override the admin order notification, copy: wp-content/plugins/woocommerce/templates/emails/admin-new-order.php to wp-content/themes/yourtheme/woocommerce/emails/admin-new-order.php
What you have to do is to copy the contents of customer-new-account.php
and inside your theme ( preferably child theme because of this ) create a file here wp-content/themes/yourtheme/woocommerce/emails/customer-new-account.php
and update the line 25 as such.
<p><?php printf( esc_html__( 'Thank you for signing up. Message us 1000 on WhatsApp to select your free gift with your first purchase. %1$s).', 'woocommerce' ), make_clickable( esc_url( 'Add URL HERE' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
You can also go to this page wp-admin/admin.php?page=wc-settings&tab=email§ion=wc_email_customer_new_account
and hit this button to automatically copy template to your theme.
Click on
Copy file to theme