Created
May 4, 2019 16:36
-
-
Save blivic/6efb3ef8248f843523cae668e3cdf551 to your computer and use it in GitHub Desktop.
Adding product title(s) to new order admin email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function admin_email_subject_with_product_names( $subject, $order ) { | |
$products_names = array(); | |
foreach ( $order->get_items() as $item ) { | |
$products_names[] = $item->get_name(); | |
} | |
return sprintf( '[%s] Nova narudžba kupca (#%s) - %s', | |
wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), | |
$order->get_id(), | |
implode(', ', $products_names) | |
); | |
} | |
add_filter('woocommerce_email_subject_new_order', 'admin_email_subject_with_product_names', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment