Reputation: 63
I want to remove total and subtotal from woocommerce new order mail. This code works for total but subtotal is still displayed.
add_filter( 'woocommerce_get_order_item_totals', 'reordering_order_item_totals', 10, 3 );
function reordering_order_item_totals( $total_rows, $order, $tax_display ){
$shipping = $total_rows['line_subtotal'];
$order_total = $total_rows['order_total'];
unset($total_rows['line_subtotal']);
unset($total_rows['order_total']);
return $total_rows;
}
I tried ['line_subtotal']
, ['order_subtotal']
, ['subtotal']
do you know its name?
Thank you a lot
Upvotes: 2
Views: 727
Reputation: 21681
please try below code in functions.php file
add_filter( 'woocommerce_get_order_item_totals', 'reordering_order_item_totals', 10, 3 );
function reordering_order_item_totals( $total_rows, $order, $tax_display ){
$shipping = $total_rows['cart_subtotal'];
$order_total = $total_rows['order_total'];
unset($total_rows['cart_subtotal']);
unset($total_rows['order_total']);
return $total_rows;
}
Upvotes: 2