Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change email subject lines
/*
* goes in theme functions.php or a custom plugin
*
* Subject filters:
* woocommerce_email_subject_new_order
* woocommerce_email_subject_customer_processing_order
* woocommerce_email_subject_customer_completed_order
* woocommerce_email_subject_customer_invoice
* woocommerce_email_subject_customer_note
* woocommerce_email_subject_low_stock
* woocommerce_email_subject_no_stock
* woocommerce_email_subject_backorder
* woocommerce_email_subject_customer_new_account
* woocommerce_email_subject_customer_invoice_paid
**/
add_filter('woocommerce_email_subject_new_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;
}
@cartpauj

This comment has been minimized.

Copy link

@cartpauj cartpauj commented Nov 12, 2019

WooSubscriptions Email Subject Filters and Params
woocommerce_email_subject_customer_processing_renewal_order ($subject, $order)
woocommerce_email_subject_payment_retry ($subject, $order)
woocommerce_email_subject_suspended_subscription ($subject, $subscription)
woocommerce_email_subject_new_switch_order ($subject, $order)
woocommerce_email_subject_new_renewal_order ($subject, $order)
woocommerce_email_subject_expired_subscription ($subject, $subscription)
woocommerce_email_subject_customer_renewal_invoice ($subject, $order)
woocommerce_email_subject_customer_payment_retry ($subject, $order)
woocommerce_email_subject_customer_completed_switch_order ($subject, $order)
woocommerce_email_subject_customer_completed_renewal_order ($subject, $order)
woocommerce_email_subject_cancelled_subscription ($subject, $subscription)

@cartpauj

This comment has been minimized.

Copy link

@cartpauj cartpauj commented Nov 12, 2019

WooMemberships Email Subject Filters and Params
woocommerce_email_subject_WC_Memberships_User_Membership_Activated_Email ($subject, $user_membership)
woocommerce_email_subject_WC_Memberships_User_Membership_Ended_Email ($subject, $user_membership)
woocommerce_email_subject_WC_Memberships_User_Membership_Ending_Soon_Email ($subject, $user_membership)
woocommerce_email_subject_WC_Memberships_User_Membership_Note_Email ($subject, $user_membership)
woocommerce_email_subject_WC_Memberships_User_Membership_Renewal_Reminder_Email ($subject, $user_membership)

@GhostPengy

This comment has been minimized.

Copy link

@GhostPengy GhostPengy commented Jan 8, 2020

Missing filters:
woocommerce_email_subject_customer_on_hold_order
woocommerce_email_subject_cancelled_order
woocommerce_email_subject_customer_refunded_order
woocommerce_email_subject_failed_order

@helgatheviking

This comment has been minimized.

Copy link

@helgatheviking helgatheviking commented Jun 8, 2020

Needs to use getters for WC 3.0 or else you will get notices about directly accessing object properties.

$order->id, $order->billing_first_name, $order->billing_last_name

should be

$order->get_id(), $order->get_billing_first_name(), $order->get_billing_last_name()

@raindeer

This comment has been minimized.

Copy link

@raindeer raindeer commented Apr 14, 2021

woocommerce_email_subject_customer_payment_retry shall actually be woocommerce_subscriptions_email_subject_customer_retry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment