Commit 41ece26eae4 for woocommerce
commit 41ece26eae414be4c5f49355de1b4ffce7478107
Author: Ján Mikláš <neosinner@gmail.com>
Date: Mon Jul 27 15:53:20 2026 -0400
Fix 'Free' label in email order totals applying to non-shipping rows (#66836)
* Fix 'Free' relabel in email totals firing on non-shipping rows
* Update email totals free shipping label to 'Free!' matching core copy
diff --git a/plugins/woocommerce/templates/emails/email-order-details.php b/plugins/woocommerce/templates/emails/email-order-details.php
index 73a232af6f0..e31f68e37f8 100644
--- a/plugins/woocommerce/templates/emails/email-order-details.php
+++ b/plugins/woocommerce/templates/emails/email-order-details.php
@@ -153,8 +153,8 @@ endif;
++$i;
$last_class = ( $i === $item_totals_count ) ? ' order-totals-last' : '';
// The shipping method name is already shown in the row header, so avoid duplicating it in the value cell.
- if ( $email_improvements_enabled && isset( $total['meta'] ) && $total['value'] === $total['meta'] ) {
- $total['value'] = __( 'Free', 'woocommerce' );
+ if ( $email_improvements_enabled && 'shipping' === ( $total['type'] ?? '' ) && isset( $total['meta'] ) && $total['value'] === $total['meta'] ) {
+ $total['value'] = __( 'Free!', 'woocommerce' );
}
?>
<tr class="order-totals order-totals-<?php echo esc_attr( $total['type'] ?? 'unknown' ); ?><?php echo esc_attr( $last_class ); ?>">
diff --git a/plugins/woocommerce/templates/emails/plain/email-order-details.php b/plugins/woocommerce/templates/emails/plain/email-order-details.php
index 7709b1f9429..8a0da355c27 100644
--- a/plugins/woocommerce/templates/emails/plain/email-order-details.php
+++ b/plugins/woocommerce/templates/emails/plain/email-order-details.php
@@ -65,8 +65,8 @@ if ( $item_totals ) {
foreach ( $item_totals as $total ) {
if ( $email_improvements_enabled ) {
// The shipping method name is already shown in the row header, so avoid duplicating it in the value cell.
- if ( isset( $total['meta'] ) && $total['value'] === $total['meta'] ) {
- $total['value'] = __( 'Free', 'woocommerce' );
+ if ( 'shipping' === ( $total['type'] ?? '' ) && isset( $total['meta'] ) && $total['value'] === $total['meta'] ) {
+ $total['value'] = __( 'Free!', 'woocommerce' );
}
$label = $total['label'];
if ( isset( $total['meta'] ) ) {