In Woocommerce I would like to set the product purchased in the "new order" email subject line, something like this: New Order - [{product_name}] ({order_number}) - {order_date}
I understand that product_name
cant be used probably due to multiple products is there a way I can still do this by filtering product ordered or just allowing multiple products as not many multi orders go through.
Very new to modifying theme code but any help would be greatly appreciated.
The Email settings for "New Order" the subject need to be (as in your question):
New Order - [{product_name}] ({order_number}) - {order_date}
In the code bellow I replace
{product_name}
by the items product names (separated by a dash) as an order can have many items…This custom function hooked in
woocommerce_email_subject_new_order
will do the trick:Code goes in function.php file of your active child theme (or active theme).
Tested and works.
You will get something like this: