0

In Woocommerce, I am trying to edit the email template for customer invoice email and I don't know how to write the right code to show the product name and time. How this can be done?

Any help will be appreciated.

Here is my code (added to function.php file):

add_action( 'woocommerce_email_after_order_table', 'add_content_specific_email', 20, 4 );

function add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {
    if ( $email->id == 'customer_invoice' ) {
        echo '<a href="http://www.google.com/calendar/event?action=TEMPLATE&text=[LocalRunners]$item_name"><h2 class="email-upsell-title"> Add to my calendar</h2></a>';
    }
}
LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • What do you mean by product time? Also remember that an order can have many items, so different product names… – LoicTheAztec Jul 25 '18 at 09:21
  • because my site want to provide local tour. Usually client will book a date for tour. so I want let customer to add to calendar according the date to remind them. And usually they will only book one product in an order. – JERRY Jul 25 '18 at 10:52
  • Regarding time, are you referring any custom meta field here? – Outsource WordPress Jul 25 '18 at 12:16
  • maybe yes......, because I am not professional in coding....Just trying to figure it out.Thank you :) – JERRY Jul 25 '18 at 13:51

0 Answers0