sherin
sherin

Reputation: 61

How to remove "Shipping" label from Woocommerce Email notifications?

I want to remove or hide "shipping" label from woocommerce order confirmation Email table.

enter image description here

Upvotes: 1

Views: 2685

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253773

The following little code snippet will remove only the label "Shipping", from email notifications:

add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
    // Only on emails notifications
    if( ! is_wc_endpoint_url() || ! is_admin() ) {
        // Remove "Shipping" label text from totals rows
        $total_rows['shipping']['label'] = '';
    }
    return $total_rows;
}

Code goes in function.php file of your active child theme (active theme). Tested and works.


To remove the shipping total line from email notifications, use the following instead:

add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
    // Only on emails notifications
    if( ! is_wc_endpoint_url() || ! is_admin() ) {
        // Remove shipping line from totals rows
        unset($total_rows['shipping']);
    }
    return $total_rows;
}

Code goes in function.php file of your active child theme (active theme). Tested and works.


It's not possible to target a specific email notification.

Upvotes: 4

Related Questions