enter image description here

I want to update the header saying "custommer_name sent a GIFT for you".It's not working !!

<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header">
                    <td id="header_wrapper">
                              $order = new WC_Order($order_id);
                              echo $order->get_billing_email() . $email_heading; 
  • This site is meant for asking for help with your own code, so it's expected that you show what you've tried and then ask if anyone knows why it's not working. Having said that, gift card functionality is not part of Woocommerce's core functions, so it would at least help if you mentioned what plugin you're using!
    – Peter HvD
    Jun 22, 2018 at 15:34

1 Answer 1


For this you need to override class or create your custom email type, I can give a short hint on the modifications to be made in the class further you can override in your child theme or plugin if you don't want to loose the changes on woocommerce update.

In /woocommerce/includes/emails/class-wc-email-customer-completed-order.php

On line 37:

$this->placeholders   = array(
    '{site_title}'   => $this->get_blogname(),
    '{order_date}'   => '',
    '{order_number}' => '',
    '{order_name}' => '',

Here I added {order_name},

Then on line 86

if ( is_a( $order, 'WC_Order' ) ) {
    $this->object                         = $order;
    $this->recipient                      = $this->object->get_billing_email();
    $this->placeholders['{order_date}']   = wc_format_datetime( $this->object->get_date_created() );
    $this->placeholders['{order_number}'] = $this->object->get_order_number();
    $this->placeholders['{order_name}'] = $this->object->get_billing_first_name();

Here I defined First name to {order_name}, now you can use this placeholder in woocommerce email settings at /wp-admin/admin.php?page=wc-settings&tab=email&section=wc_email_customer_processing_order

  • Thanks for your answer. It didn't solve my problem exactly but I get the idea and your answer will help me later thank you again. Jun 25, 2018 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.