0

I'm trying to add some labels after woocommrce order email items.

Example: We can do that on cart by using this filter.

add_filter( 'woocommerce_cart_item_name', array( $this, 'wc_esd_show_date_cart_page' ), 10, 2 );

This calls the wc_esd_show_date_cart_page() function and show its data after the item name.

I want to do the same for order email items, anyone know there have some filter for it, or another way to do this.

enter image description here

1

you can do this with a differnent woocommerce hook:

woocommerce_order_item_meta_end ($item_id, $item, $order, $plain_text)

use it similarly to the cart filter above.

For a visual representation if you want the additional information somewhere else see this link:

https://businessbloomer.com/woocommerce-visual-hook-guide-emails/

You can also always go right to the source and see all the hooks/filters/actions in woocommerce: https://docs.woocommerce.com/wc-apidocs/hook-docs.html

as an example:

add_action( 'woocommerce_order_item_meta_end', 'rt_order_item_meta_end', 10, 4 );
function rt_order_item_meta_end( $item_id, $item, $order, $plain_text ){
    echo '<p>cool item detail</p>';
}
  • i checked it like this add_action( 'woocommerce_order_item_meta_end', array( $this, 'wc_esd_show_email' ), 10, 3 ); public function wc_esd_show_email( $item_id, $item, $order ) { echo 'tetsing custom text'; } but it seems not showing, did i do anything wrong – Suneth Kalhara Dec 19 '18 at 17:55
  • 1
    I added an example. Your callback needs the arguments to work. – rudtek Dec 19 '18 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.