By Steve


2019-07-11 08:45:29 8 Comments

I would like to ask for some help / advice. Currently, we use the admin new order email as a picking list that gets printed off, but we now have an average of 3 variations per product and the printed name is now getting rather long, as per the format below.

what I would like to ask help for is to determine which hooks control the naming so I can remove all the variant elements, (leaving standard name and sku) and to then apply it to the admin email only.

My initial thought is to do something like the below, but I cannot see how i can determine if it is an admin email or not as I don't have access to $email..

Any help is appreciated.


function variation_title_not_include_attributes( $boolean ){ 

if (  is_email() )  {
$boolean = false; 
return $boolean; 
}
return true;
}
Current Sample output:

Test product (Test SKU)
•   Variant 1: 
Variant 1 Option
•   Variant 2: 
Variant 2 Option
•   Variant 3: 
Variant 3 Option

1 comments

@Dan Wich 2019-07-11 19:04:02

One approach would be to override woocommerce/templates/emails/email-order-items.php (and possibly the version for plain-text emails) with your own version. It has access to $sent_to_admin, so you could replace its call to echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $item->get_name(), $item, false ) ); with your own.

@Steve 2019-07-12 11:29:11

Thanks that has helped me get further on. It was the wc_display_item_meta(...) section that needed commenting out, and then in the bit above to replace $item->get_name() with $product->get_formatted_name() as for some reason $item->get_name() is ignoring my filter add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_true' );

Related Questions

Sponsored Content

1 Answered Questions

Woocommerce Canceled Order Notification email to admin

  • 2019-07-07 11:42:31
  • haciawo
  • 330 View
  • 0 Score
  • 1 Answer
  • Tags:   woocommerce

1 Answered Questions

[SOLVED] Add product tag names to WooCommerce new order email subject

  • 2019-05-03 20:57:54
  • Nick Taylor
  • 96 View
  • 1 Score
  • 1 Answer
  • Tags:   php woocommerce

1 Answered Questions

1 Answered Questions

Adding time of order to Admin email for new order

  • 2018-09-28 18:15:40
  • ihtxam
  • 39 View
  • 0 Score
  • 1 Answer
  • Tags:   woocommerce email

1 Answered Questions

[SOLVED] Woocommerce 2.5.5 get billing email from order instance

  • 2018-06-18 02:16:00
  • Genius in trouble
  • 1190 View
  • 0 Score
  • 1 Answer
  • Tags:   woocommerce

1 Answered Questions

[SOLVED] WooCommerce - Email admin with new user details

1 Answered Questions

[SOLVED] woocommerce - hide payment method in new order email

  • 2016-10-14 08:46:54
  • Nancy
  • 2183 View
  • 0 Score
  • 1 Answer
  • Tags:   php woocommerce

Sponsored Content