Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created June 17, 2019 20:25
Show Gist options
  • Save plugin-republic/7cddfabd342f0d148b237825189f78d2 to your computer and use it in GitHub Desktop.
Save plugin-republic/7cddfabd342f0d148b237825189f78d2 to your computer and use it in GitHub Desktop.
<?php
/**
* Add custom cart item data to emails
*/
function plugin_republic_order_item_name( $product_name, $item ) {
if( isset( $item['pr_field'] ) ) {
$product_name .= sprintf(
'<ul><li>%s: %s</li></ul>',
__( 'Your name', 'plugin_republic' ),
esc_html( $item['pr_field'] )
);
}
return $product_name;
}
add_filter( 'woocommerce_order_item_name', 'plugin_republic_order_item_name', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment