Commit edc2e571433 for woocommerce

commit edc2e5714339e5d40df7f02bb362516141a5fa94
Author: Abdalsalaam Halawa <abdalsalaamnafez@gmail.com>
Date:   Thu Mar 12 17:20:13 2026 +0200

    Fix: shipping row style when Cost of Goods Sold is enabled on the order edit screen (#63396)

diff --git a/plugins/woocommerce/changelog/63396-fix-issue-63394 b/plugins/woocommerce/changelog/63396-fix-issue-63394
new file mode 100644
index 00000000000..f9b3de010ff
--- /dev/null
+++ b/plugins/woocommerce/changelog/63396-fix-issue-63394
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix misaligned order rows on the edit order screen when Cost of Goods Sold is enabled.
\ No newline at end of file
diff --git a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-fee.php b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-fee.php
index 79c0236b2f5..b73bd70222d 100644
--- a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-fee.php
+++ b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-fee.php
@@ -27,6 +27,10 @@ if ( ! defined( 'ABSPATH' ) ) {

 	<?php do_action( 'woocommerce_admin_order_item_values', null, $item, absint( $item_id ) ); ?>

+	<?php if ( $cogs_is_enabled ) : ?>
+	<td class="item_cost_of_goods"></td>
+	<?php endif; ?>
+
 	<td class="item_cost" width="1%">&nbsp;</td>
 	<td class="quantity" width="1%">&nbsp;</td>

diff --git a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-refund.php b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-refund.php
index 7d77c1165e7..4900f3c65c5 100644
--- a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-refund.php
+++ b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-refund.php
@@ -49,6 +49,10 @@ $who_refunded = new WP_User( $refund->get_refunded_by() );

 	<?php do_action( 'woocommerce_admin_order_item_values', null, $refund, $refund->get_id() ); ?>

+	<?php if ( $cogs_is_enabled ) : ?>
+	<td class="item_cost_of_goods"></td>
+	<?php endif; ?>
+
 	<td class="item_cost" width="1%">&nbsp;</td>
 	<td class="quantity" width="1%">&nbsp;</td>

diff --git a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-shipping.php b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-shipping.php
index a69e06c47c1..c00470d6eff 100644
--- a/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-shipping.php
+++ b/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-shipping.php
@@ -57,6 +57,9 @@ if ( ! defined( 'ABSPATH' ) ) {

 	<?php do_action( 'woocommerce_admin_order_item_values', null, $item, absint( $item_id ) ); ?>

+	<?php if ( $cogs_is_enabled ) : ?>
+	<td class="item_cost_of_goods"></td>
+	<?php endif; ?>
 	<td class="item_cost" width="1%">&nbsp;</td>
 	<td class="quantity" width="1%">&nbsp;</td>

diff --git a/plugins/woocommerce/includes/class-wc-ajax.php b/plugins/woocommerce/includes/class-wc-ajax.php
index 2f78b8a3da2..3845f9ab33c 100644
--- a/plugins/woocommerce/includes/class-wc-ajax.php
+++ b/plugins/woocommerce/includes/class-wc-ajax.php
@@ -1312,6 +1312,7 @@ class WC_AJAX {

 			$order_taxes      = $order->get_taxes();
 			$shipping_methods = WC()->shipping() ? WC()->shipping()->load_shipping_methods() : array();
+			$cogs_is_enabled  = wc_get_container()->get( CostOfGoodsSoldController::class )->feature_is_enabled();

 			// Add new shipping.
 			$item = new WC_Order_Item_Shipping();
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index 2883f1ea213..a589d6b82f9 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -5910,6 +5910,12 @@ parameters:
 			count: 1
 			path: includes/admin/meta-boxes/views/html-order-fee.php

+		-
+			message: '#^Variable \$cogs_is_enabled might not be defined\.$#'
+			identifier: variable.undefined
+			count: 1
+			path: includes/admin/meta-boxes/views/html-order-fee.php
+
 		-
 			message: '#^Variable \$tax_item_total in isset\(\) always exists and is not nullable\.$#'
 			identifier: isset.variable
@@ -6084,6 +6090,12 @@ parameters:
 			count: 1
 			path: includes/admin/meta-boxes/views/html-order-refund.php

+		-
+			message: '#^Variable \$cogs_is_enabled might not be defined\.$#'
+			identifier: variable.undefined
+			count: 1
+			path: includes/admin/meta-boxes/views/html-order-refund.php
+
 		-
 			message: '#^Call to an undefined method object\:\:get_method_id\(\)\.$#'
 			identifier: method.notFound
@@ -6120,6 +6132,12 @@ parameters:
 			count: 4
 			path: includes/admin/meta-boxes/views/html-order-shipping.php

+		-
+			message: '#^Variable \$cogs_is_enabled might not be defined\.$#'
+			identifier: variable.undefined
+			count: 1
+			path: includes/admin/meta-boxes/views/html-order-shipping.php
+
 		-
 			message: '#^Variable \$order might not be defined\.$#'
 			identifier: variable.undefined