$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Woocommerce order processing email subject not changing|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Woocommerce order processing email subject not changing

matteradmin9PV0评论

I am using this hook woocommerce_email_subject_customer_procesing_order to change email subject but it is not working. I have tried other hooks to update subject for order completion woocommerce_email_subject_customer_completed_order or on hold woocommerce_email_subject_customer_on_hold_order and these hooks are working fine. Can anybody guide me about this issue. I do not have a lot of woo commerce experience and need some help to fix this issue. Here is my code

add_filter('woocommerce_email_subject_customer_procesing_order', 'change_admin_email_subjects', 999, 2 );
  function change_admin_email_subjects( $subject, $order ) {
  global $woocommerce;
  $subject = 'Your Job Posting Receipt';
  return $subject;
}

I know we can change subject via woo commerce settings but I have some conditions for this update so that is why I am trying to do this using woo commerce hook.

I am using this hook woocommerce_email_subject_customer_procesing_order to change email subject but it is not working. I have tried other hooks to update subject for order completion woocommerce_email_subject_customer_completed_order or on hold woocommerce_email_subject_customer_on_hold_order and these hooks are working fine. Can anybody guide me about this issue. I do not have a lot of woo commerce experience and need some help to fix this issue. Here is my code

add_filter('woocommerce_email_subject_customer_procesing_order', 'change_admin_email_subjects', 999, 2 );
  function change_admin_email_subjects( $subject, $order ) {
  global $woocommerce;
  $subject = 'Your Job Posting Receipt';
  return $subject;
}

I know we can change subject via woo commerce settings but I have some conditions for this update so that is why I am trying to do this using woo commerce hook.

Share Improve this question asked Dec 3, 2018 at 23:16 wpddwpdd 3134 silver badges15 bronze badges 1
  • try this add_filter(' woocommerce_email_subject_customer_processing_order', 'change_admin_email_subject', 1, 2); function change_admin_email_subject( $subject, $order ) { global $woocommerce; $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $subject = sprintf( '[%s] New Customer Order (# %s) from Name %s %s', $blogname, $order->id, $order->billing_first_name, $order->billing_last_name ); return $subject; } – vikrant zilpe Commented Dec 4, 2018 at 12:25
Add a comment  | 

1 Answer 1

Reset to default 1

The email template variables can only be used in the body of the emails. If you want to change the email titles/subject lines then you would need to use a the corresponding filter and add some custom code to a child themes functions.php file or via a custom plugin.

The WooCommerce documentation has a snippet for doing this: https://docs.woocommerce/document/change-email-subject-lines/

As an example for the processing order you would use:

add_filter( 'woocommerce_email_subject_customer_processing_order', 'change_processing_email_subject', 1, 2 );

function change_processing_email_subject( $subject, $order ) {
global $woocommerce;

$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

$subject = sprintf( 'Hi %s, thanks for your order on %s', $order- 
>billing_first_name, $blogname );                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
return $subject;
}
Post a comment

comment list (0)

  1. No comments so far