A client of mine uses a woocommerce webshop and asked me the following: i'm looking for a way to make the emailaddress of the customer in the customer details section of the admin-new-order email, a 'mailto:' link.
UPDATE
With your help so far i've found the correct file to edit (email-customer-details.php), but i'm not quite sure how to edit the file. So far it only states this:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
<ul>
<?php foreach ( $fields as $field ) : ?>
<li><strong><?php echo wp_kses_post( $field['label'] ); ?>:</strong> <span class="text"><?php echo wp_kses_post( $field['value'] ); ?></span></li>
<?php endforeach; ?>
</ul>
The output gives al list with the following:
Customer comment
Customer phonenumber
Customer e-mailadres
You can do that via changing the email-customer-details.php email template that you can find at : /plugins/woocommerce/templates/emails/
Just copy that file into your theme like your-theme/woocommerce/emails/email-customer-details.php and do the changes over there as you need.
Reference link
Related
How can I display some custom error message when user clicks "place order" with card payment method selected, is redirected to the bank website, but then hits "cancel" and gets redirected back to WooCommerce thank you page?
The WooCommerce thank you page template code is summarized here (just in case I know how to add custom WooCommerce templates in my child theme):
if ( $order ) : ?>
<?php if ( $order->has_status( 'failed' ) ) : ?>
<p><?php _e( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction.', 'woocommerce' ); ?></p>
<?php else : ?>
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p>
<?php endif; ?>
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>
<?php do_action( 'woocommerce_thankyou', $order->id ); ?>
<?php else : ?>
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), null ); ?></p>
<?php endif; ?>
Where does the bank payment cancelling case is located in this code? And how to display a custom message like "you cancelled bank payment, your order has been cancelled"?
function wdm_my_custom_message( $order_id ){
global $woocommerce;
$order=new WC_Order($order_id);
if ( $order->has_status( 'failed' ) ) {
$woocommerce->add_error( __( 'you cancelled bank payment, your order has been cancelled.', 'woocommerce' ) );
}
}
add_action( 'woocommerce_thankyou','wdm_my_custom_message',10,1);
this will help you to achieve your purpose.
I need anything that, when a order is created, it sends in addition to the email that goes to the costumer, an email to one of my email accouts with only some information the customer inserted, such as:
Name
Surname
Street
Country etc.
How could I archive this?
Go to yoursite.com/wp-admin/admin.php?page=wc-settings&tab=email§ion=wc_email_new_order or from the dashboard:
Go to the WooCommerce sections and in that go to the Settings
In settings click on the Email tab and in that click on the New Order tab.
At the bottom of that page there is a button called: "Copy file to theme", click on that and then click on the "View Template" button. Replace the contents of the email from <?php do_action( 'woocommerce_email_header', $email_heading ); ?> down with:
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
<?php echo $order->get_formatted_billing_address(); ?>
<?php if ( $order->billing_email ) : ?>
<p><strong><?php _e( 'Email:', 'woocommerce' ); ?></strong> <?php echo $order->billing_email; ?></p>
<?php endif; ?>
<?php if ( $order->billing_phone ) : ?>
<p><strong><?php _e( 'Tel:', 'woocommerce' ); ?></strong> <?php echo $order->billing_phone; ?></p>
<?php endif; ?>
The above removes the order details and keeps the customers details.
Okay, I have the code pulling the custom fields URL and title of the url. Now I can't seem to get it to show the second featured blog. Here is the working code.
<?php $related = get_post_meta($post->ID, "Featured-Blog", $single=true);
$related=explode(',',$related);
$args = array_merge( array('post__in' => $related, $wp_query->query ) );
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="<?php the_ID(); ?>">
<p class="caption"><?php the_title(); ?></p>
</div>
<?php endwhile; else: ?>
<p>no related</p>
<?php endif; wp_reset_query();?>
This code example here produces two results, which is almost what I want. Which is caused by the foreach I believe. I do not want to use the code below, but I need to find a way to add the foreach I think to get it to list all of the featured-blogs if I have more than one.
<?php
$custom_fields = get_post_custom($post_id); //Current post id
$my_custom_field = $custom_fields['Featured-Blog']; //key name
foreach ( $my_custom_field as $key => $url )
echo $key ="<a href='".$url."'>TEST</a><br /><br /><br/>";
?>
Here is a screenshot showing my Custom Fields if it helps at all, and the results they are showing on the site. screenshot
Example 1: You are using the actual word 'TITLE' for the link use <?php the_title() ?> instead
Example 2: You are not building link at all. Your href attribute is empty. Cut echo $featured_blog1 and paste it to href attribute to end up like so:
Example 3: Same as 2
Also you can delete dose instructions or put them inside <?php ?> code so they are not visible to viewers.
Hope this helps.
If you need more info just ask. ;)
In my list of members, I show the standard fields of avatar, username, profile data, etc - this all works fine.
I'd like to also show the 'most recent post' from that user too.
Is there a snippet I can use to grab the most recent post from that author? Somehow identifying which author it is and their most recent post?
Thanks,
Ian
Somebody provided me with a great fix for this:
<?php
$user_id = bp_get_member_user_id();
$query = new WP_Query( 'author=' . $user_id );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
//display title
the_title();
//display content
the_content(); ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php the_field('featuredimage'); ?>" alt="" />
</a>
<?php }
}
//reset for next member
wp_reset_postdata();
?>
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a problem with my wordpress blog here(http://muraliprashanth.me) everything seems to be working fine but the problem is after each post i am appending author information like the image below
but when i click on the
View all posts by Murali Prashanth hyperlink
it's redirecting me to this URL http://muraliprashanth.me/author/Murali%20Prashanth/
I don't know where to create the author profile page or does my wordpress theme supports author profile pages or not Please suggest me i am struggling to resolve this issue from past 3 months, Help is much appreciated.
Thanks in advance.
These two links have the details about the author profile linking as well as template information. Have a look and see if you are able to fix it.
http://codex.wordpress.org/Author_Templates
http://codex.wordpress.org/Function_Reference/the_author_url
Try it. I 've given my author.php file for usage.
<?php
/**
* The template for displaying Author Archive pages.
*
* #package WordPress
*/
get_header(); ?>
<?php
if ( have_posts() )
the_post();
?>
<h1><?php printf( __( 'Author Archives: %s' ), "<span class='vcard'><a class='url fn n' href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></span>" ); ?></h1>
<?php
// If a user has filled out their description, show a bio on their entries.
if ( get_the_author_meta( 'description' ) ) : ?>
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'avatar_size', 60 ) ); ?>
<h2><?php printf( __( 'About %s', 'theme' ), get_the_author() ); ?></h2>
<?php the_author_meta( 'description' ); ?>
<?php endif; ?>
<?php
rewind_posts();
get_template_part( 'loop', 'author' );
?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>