When receiving confirmation emails and/or invoice email, I would like the client see the SKU instead of the product name on the order detail.
I tried the code below, but it shows the SKU between brackets under the product name.
function sww_add_sku_woocommerce_emails( $output, $order ) {
static $run = 0;
if ( $run ) {
return $output;
}
$args = array(
'show_sku' => true,
);
$run++;
return $order->email_order_items_table( $args );
}
add_filter( 'woocommerce_email_order_items_table', 'sww_add_sku_woocommerce_emails', 10, 2 );
However I would like the SKU totally replace the product name and not appears between brackets and if possible to change the text by Product SKU [SKU code].
What is the correct code to replace the product name by the SKU in emails notifications?