Commit 73ebf6058d for woocommerce

commit 73ebf6058df1d3278ee45b732c181a6b3a0c65d9
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed Dec 17 17:15:11 2025 +0000

    Update summary title to "Discount" instead of coupon(s) and ensure negative fees are reflected in order details (#62454)

    * Update summary item to "Discount" instead of coupon to be more accurate

    * Show fee value even if fee amount is negative

    * Add tests for negative fees

    * Add changelog

    * Lint fix

    * Update e2e test for updated discount name

diff --git a/plugins/woocommerce/changelog/2025-12-15-17-18-50-141498 b/plugins/woocommerce/changelog/2025-12-15-17-18-50-141498
new file mode 100644
index 0000000000..8eed4af923
--- /dev/null
+++ b/plugins/woocommerce/changelog/2025-12-15-17-18-50-141498
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Ensure discount fees are included in the order subtotal calculation on the admin order view
diff --git a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
index 9ae68c59d2..6787f8f51c 100644
--- a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
+++ b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php
@@ -176,14 +176,14 @@ if ( wc_tax_enabled() ) {
 			</tr>
 		<?php if ( 0 < $order->get_total_discount() ) : ?>
 			<tr>
-				<td class="label"><?php esc_html_e( 'Coupon(s):', 'woocommerce' ); ?></td>
+				<td class="label"><?php esc_html_e( 'Discount:', 'woocommerce' ); ?></td>
 				<td width="1%"></td>
 				<td class="total">-
 					<?php echo wc_price( $order->get_total_discount(), array( 'currency' => $order->get_currency() ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
 				</td>
 			</tr>
 		<?php endif; ?>
-		<?php if ( 0 < $order->get_total_fees() ) : ?>
+		<?php if ( abs( $order->get_total_fees() ) > 0 ) : ?>
 			<tr>
 				<td class="label"><?php esc_html_e( 'Fees:', 'woocommerce' ); ?></td>
 				<td width="1%"></td>
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
index 28ac1ff29c..3599a5e935 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/order/order-coupon.spec.js
@@ -108,7 +108,7 @@ test.describe(
 					.filter( { hasText: couponCode } )
 			).toBeVisible();
 			await expect(
-				page.getByRole( 'cell', { name: 'Coupon(s)' } )
+				page.getByRole( 'cell', { name: 'Discount:', exact: true } )
 			).toBeVisible();
 			await expect(
 				page.getByRole( 'cell', { name: `- $${ couponAmount }.00` } )
@@ -132,7 +132,7 @@ test.describe(
 					.filter( { hasText: couponCode } )
 			).toBeVisible();
 			await expect(
-				page.getByRole( 'cell', { name: 'Coupon(s)' } )
+				page.getByRole( 'cell', { name: 'Discount:', exact: true } )
 			).toBeVisible();
 			await expect(
 				page.getByRole( 'cell', {
diff --git a/plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php b/plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
index 18f9408d06..463bc7e99b 100644
--- a/plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
+++ b/plugins/woocommerce/tests/legacy/unit-tests/order/class-wc-tests-crud-orders.php
@@ -2100,4 +2100,45 @@ class WC_Tests_CRUD_Orders extends WC_Unit_Test_Case {

 		$this->assertEquals( 110.06, $order->get_total_fees() );
 	}
+
+	/**
+	 * Test that WC_Order::get_total_fees() returns negative values for discount fees.
+	 */
+	public function test_get_total_fees_should_return_negative_fees() {
+		$order = WC_Helper_Order::create_order();
+
+		$fee = new WC_Order_Item_Fee();
+		$fee->set_props(
+			array(
+				'name'       => 'Discount Fee',
+				'tax_status' => ProductTaxStatus::NONE,
+				'total'      => -10,
+			)
+		);
+		$order->add_item( $fee );
+
+		$this->assertEquals( -10, $order->get_total_fees() );
+	}
+
+	/**
+	 * Test that WC_Order::get_total_fees() correctly sums mixed positive and negative fees.
+	 */
+	public function test_get_total_fees_should_sum_mixed_positive_and_negative_fees() {
+		$order      = WC_Helper_Order::create_order();
+		$fee_totals = array( 25, -10, 5.50 ); // Net: 20.50.
+
+		foreach ( $fee_totals as $total ) {
+			$fee = new WC_Order_Item_Fee();
+			$fee->set_props(
+				array(
+					'name'       => $total < 0 ? 'Discount Fee' : 'Regular Fee',
+					'tax_status' => ProductTaxStatus::NONE,
+					'total'      => $total,
+				)
+			);
+			$order->add_item( $fee );
+		}
+
+		$this->assertEquals( 20.50, $order->get_total_fees() );
+	}
 }