Reputation: 21
When the customer order is placed, I would like if free shipping has been used, to remove shipping info
from the order confirmation mail to the customer.
Is it possible to achieve this?
Upvotes: 2
Views: 2283
Reputation: 253773
This is possible with this custom hooked function (but from all email notifications):
add_filter( 'woocommerce_get_order_item_totals', function( $total_rows, $order, $tax_display ){
// Only for "Free Shipping" method
if( ! $order->has_shipping_method('free_shipping') || is_account_page() || is_wc_endpoint_url( 'order-received' ) )
return $total_rows;
unset($total_rows['shipping']);
return $total_rows;
}, 11, 3 );
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works.
Upvotes: 2