for some reason the emails being sent to customers after they create a WooCommerce account displays a random name (see attached).
WooCommerce username error
I think because users can create an account with just an email address? But anyway - I want to just remove the Hi xxxx from all email communication from the customer. How do I do this? I am looking at the email templates but can't see how this code is generated?
To remove the name from email communication, you need to copy the email template file in your theme directory (e.g - customer-processing-order.php) on this find the below code:
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
And replace with the below mentioned code:
<p><?php printf( esc_html__( 'Hi,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
Same thing you can do for following Woocommerce email template files:
customer-completed-order.php
customer-completed-order.php
customer-invoice.php
customer-note.php
customer-on-hold-order.php
customer-processing-order.php
customer-refunded-order.php
Thanks - yes that solved the issue. The problem occurred because of a plugin conflict with a translation plugin. Thanks for the response to the question.
Related
On a WordPress website I'm using BuddyBoss theme and I've added a glossary plugin.
I'm trying to add a Author Box to under each glossary term, to let site visitors visit the profile of its author. To do this, I've installed a plugin called PublishPress which almost does the job but by default the profile URLs leads to the person's author profile https://example.com/author/hisname/ which should be https://example.com/members/hisname/.
By googling I found a similar solution for another theme:
// FUNCTION
// Change Post's Author URL to Buddypress Profile URL
add_filter('generate_post_author_output','generate_post_author_output_buddyprss_url');
function generate_post_author_output_buddyprss_url( $post_author_profile_link ){
$post_author_profile_link = sprintf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
__( 'by','generatepress'),
esc_url( bp_core_get_user_domain( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'Know more about %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
) ;
return $post_author_profile_link;
}
I'm wondering how can I customize the script in order to do the exact job. To be honest I'm totally screwed up. Thanks for any help!
I fixed the issue by the pro version of the PublishPress Authors. In the pro version there's a possibility to edit the layout and there's a property returning the BuddyPress Profile Link.
<a href="{{ author.buddypress_profile_link }}"...
instead of:
<a href="{{ author.link }}"...
I'm using WooCommerce in Japanese and have just modified mail template 'customer-processing-order.php' to display the customer's full name instead of his/her first name.
//before
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
//after
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_formatted_billing_full_name() ) ); ?></p>
This works fine, but the sentence below this is not translated to Japanese any more.
//This sentence is not translated to Japanese
<p><?php printf( esc_html__( 'Just to let you know — we\'ve received your order #%s, and it is now being processed:', 'woocommerce' ), esc_html( $order->get_order_number() ) ); ?></p>
I'm keeping this part intact and before making any changes, this part was translated to Japanese without problem.
Other Sentences following this are still translated into Japanese.
I have problem with just this sentence "Just to let you know — we've received your order #%s, and it is now being processed:"
I'd like to know why and the solution for this.
Additional info:
I modified mail template in admin screen going to:
WooCommerce > Settings > Emails > Processing order > Manage Then I
clicked 'Copy file to theme' button, then modified on edit screen.
WordPress Version 5.5 WooCommerce Version 4.4.1
Thank you in advance.
I need assistance with customizing a woocommerce thankyou.php file and new-order.php file.
I want to show an image before a zapper gateway instructions on the thank you email and also show it on the email sent to client for payment.
I have the image showing problem in the thankyou.php page but its also showing on all payment gateways not only on the zapper gateway and its not showing on the new-order email sent to client.
here is the code for the thankyou.php
<?php if ( $order->get_payment_method_title() === 'zapper' ); ?> <div class="zapper"> <?php echo '<p style="margin-top:0;"><img src="webiste.com/wp-content/uploads/2017/10/zapper-process.jpg"; /></p>'; ?>
Regards
Bongani
You can use a specific hook for your payment gateway woocommerce_thankyou_{payment gateway}.
add_action( 'woocommerce_thankyou_zapper', 'message_for_zapper', 5 );
function message_for_zapper( $order_id ) {
echo '<div class="zapper"><p style="margin-top:0;"><img src="webiste.com/wp-content/uploads/2017/10/zapper-process.jpg" /></p>';
}
More examples here https://rudrastyh.com/woocommerce/thank-you-page.html#add_form
I have a WordPress website with Woocommerce installed.
How can I add delivery address to the 'new order' email sent to admins? I have found how to edit this email but can't find the correct syntax.
Thanks
Please try putting this snippet in you active themes functions.php
add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_details_to_admin_emails', 15, 2 );
function wc_add_shipping_details_to_admin_emails( $order, $is_admin_email ) {
if ( $is_admin_email ) {
<p><?php echo $order->get_formatted_shipping_address(); ?></p>
}
}
In the dashboard go to Woocommerce -> Settings -> Emails and then click on the gear button in the new order email column. There will be a field to input the address. You can input multiple emails in this field, just separate them with a comma.
There are 3 authors in our company blog, each author has own site url in profile settings:
Mike - http://mike.com
Gelens - http://gelens.com
Admin - http://site.com/company/
the links for profiles are:
http://site.com/author/Mike/
http://site.com/author/Gelens/
http://site.com/author/Admin/
I need to replace a link to Admin's page, so, if there is <?php the_author_posts_link(); ?> tag on some page, and the author is Admin, the link must be http://site.com/company/ instead of http://site.com/author/Admin/.
How can I do that?
It looks like the the_author_posts_link function just calls get_author_posts_url to get the link, which passes the link through the author_link filter before returning it. In your theme's functions.php, you could add something like this (untested):
add_filter( 'author_link', 'admin_author_link', 10, 3);
function admin_author_link($link, $author_id, $author_nicename) {
if( $author_id==1 ) {
$link = 'http://site.com/company/';
}
return $link;
}
I think the least heartburn would be wordpress > the_author_meta.
Have each user add their url in the wordpress user profile, as you have done. Then in your theme's functions.php use the_author_meta('user_url'). Remember this will echo the url. To use it as a variable use get_the_author_meta('user_url').
Here is how we did it with the twenty ten theme, this is in functions.php
function twentyten_posted_on() {
printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
'meta-prep meta-prep-author',
sprintf( '<span class="entry-date">%3$s</span>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
),
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
get_the_author_meta('user_url'), //changed from get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'About %s', 'twentyten' ), get_the_author() ),
get_the_author()
)
);
}
That's URL rewriting with .htaccess, which is possible by editing the .htaccess by hand.
But easier for a beginner with a plugin such as http://wordpress.org/extend/plugins/redirection/ which seems like it will do what you need.
You can do this using http rewrites.
I also needed author URL to a different page.
My site is on WordPress and I use oxygen.
I went to my blog page template where I entered the author which is selected dynamically.
there is an option to link the author's name to the archive page or the author's website.
I selected the author's website. Then went to the users on WordPress and went to the authors and added the page I wanted to actually go to as their website.